“Ubuntu Wanted revision 20: new model interface

Recent revisions

20. By Sense Hofstede 2 minutes ago

Not working current state of the model rewrite. ToDo: skill-task bridge and let the views use the new model interface, currently they’re broken.

via “Ubuntu Wanted devel version” branch in Launchpad.

I’ve just commited the 20th revision of Ubuntu Wanted to my working copy branch of it. In this revision the largest part of the new model interface has been done.

Although it yet has to be integrated and the Model::store() function doesn’t work, the basic functions are working.
Most of the code has been moved to the Model class itself, which was abstracted.

Based on the input of the Model::init() function the Model::load() function generates the query and executes it. The only thing the extended models currently do is giving the table name.

All data is stored duplicate, a read only and a working copy. You can freely edit the working copy. If you’re done you can either revert the changes you did by executing Model::clean() or save them by executing Model::store(). That method will compare both data copies and will only update those variables and rows that were changed.

Other new things: Model::reload and Model::purge.

I still need to create a skill-task link, but I’ve already got an idea. I’m going to give the task model a method that creates a list of needed skills and request the skill model in the controller — need to figure out some kind of dependency system — and adds the references to the data of the skills used in each task entry.

Feedback is very welcome, just like programmers.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.