kirstykitto / CLAtoolkit

The Connected Learning Analytics toolkit (new django architecture, superseeding https://github.com/kirstykitto/CLAtoolkit-oldPrototypes)
GNU General Public License v3.0
27 stars 11 forks source link

Move common methods/fields to common #63

Open kojiagile opened 8 years ago

kojiagile commented 8 years ago

Move all utility functions that are used by multiple modules in the toolkit (clatoolkit/dashboard/dataintegration/etc) into a top level folder called "common".

When move them, refactor and merge it if possible. For instance, get_uid_fromsmid() method returns user ID. get_username_fromsmid() method returns username. Why not creating a method that returns both and even more (user's email, etc.)?

tommarmstrong commented 8 years ago

I think this could potentially be put under the model objects instead. Eg, User.get_from_smid() instead. Also, I think everything should return model objects instead of ids. I created new methods along those lines to help me with the transition to using the ORM more and I'll see if I can add them when merging my changes in. What do you think? (cc/ @zwaters)

zwaters commented 8 years ago

I agree, utility methods that are used to grab info from the backend should ideally be integrated with the models (similar to our UnitOffering functions). I think we'll need to consider whether there will be any use for project-wide utility functions, if there are then I think having them all contained within a "common" folder is fine.