Hi,
im currently working on a Block Plugin that loads some data via the Competency-, Course Module- and Gradebook- API into arrays, calculates some stuff and writes it into the block content. Changes are only necessary if a student gets a new grade or something in the course structure changes. Since I want to build it with best practise and good performance architecture Im thinking about the following points:
- I tried to do everything with API calls, parsing the needed data out of them. I could also put everything together in one self made SQL Query with some Joins. Which option is the better one?
- Should I hold all the data in arrays or create and insert a new DB table? I guess arrays would have the better performance but the database solution maybe prettier and easier to maintain?
- At the moment Im executing everything in the get_content() function in the main file, so everything is loaded all the time with every site refresh, which is not optimal regarding performance and modularity I guess. How can I design that better?
- With a database solution I would calculate everything and store it in a table. Then I would have to listen to events and everytime an activity gets graded or something in the course changes, like a new activity gets created, I would have to update the table in the database. Does that make sense?
I hope somebody can give me some advice regarding these issues! Also a link to an example plugin covering some of this things would help a lot!
Thank you!