Jonnie Grieve Digital Media: Blog

Home
by on 17th February, 2021 - 4:36pm (0)

Blog: R6D65: #100DaysOfCode (More Posts)

Most of the day today has been spent rebuilding the SASS Architecture behind my WordPress Starter Theme Repository. I still don’t know where those partials got to.  I’ll likely never know, but I’ve now sorted it, by reapplying the code from the stylesheet and adding the partials back to version control.

That meant I was able to get onto what got me back onto this project in the first place. Making sure the Search template and functionality were up to date on all templates… i.e. when no results are returned.  I’ve fixed up the loop to return a link of all relevant items rather than the comments. But the loop can be adapted to do more.

Elsewhere I made some progress with my Sequelize project and learned a bit more about how Sequelize works by using JS Objects and values to generate SQL code.

For example

// Retrieve movies const movies = await Movie.findAll({ include: [ { model: Person, }, ], }); console.log(movies.map(movie => movie.get({ plain: true })));

 

This method Generates a new SQL Statement that joins related data between 2 Models, Person, and Movies in a simple Database.

However, I ran into an issue with an EagerLoadingError that was returned “Person is not associated to Movie”! Meaning that despite my tests and no prior errors to this there’s been a problem linking one model to the other. It’ll be interesting to try and debug this to see what has gone wrong.

This post has been assigned to the following categories

    Leave a Reply

    Your email address will not be published. Required fields are marked *