Wednesday, November 23, 2005

Some thoughts on adding a schedule section to onplan

Multiple SCHEDULEs can be created for each project. This allows the project owner to decide whether to subdivide the project timeline or not.
When creating a SCHEDULE, start and end dates are entered, aswell as their dependecies on other SCHEDULEs.
Each SCHEDULE is divided up into WORKs. WORKs also have start and end dates, these dates may be dependent on those of other WORKs, and the WORK cannot start or end outside of the SCHEDULE timeframe.
Each WORK can be further subdivided into SUBWORKs. SUBWORKs function in the same way as WORKs albeit being restricted to the WORK timeframe.

If I include this as a section in oplan, I want to keep it simple (KIS). But how simple? I know that the above description would suffice for all of my current employers projects, but what other functionality would be useful, bearing in mind that I want to KIS?

Wednesday, November 09, 2005

A free part to onplan?

Just a thought - I'm feeling pretty good with how the upper structure of onplan is coming along. I think it could be a useful stand-alone tool for defining project partner relationships. Could maybe offering this for free (with the option of upgrading) be a good marketing ploy for onplan? Hmmm ...

Multiple addresses

Up until 30 mins ago, my company table contained columns for the companies address. However, now that I'm building the users (employees) part of onplan, I've come across a problem: What 2 users working for the same company work at different locations (as is often the case with building projects)? It's simple - create a table Addresses. Addresses belong_to Company and have_many Users.

This means now that at account sign up I've got three different models to validate (User, Company and now Address) but I'll cross that bridge when I come to it.

Find_by_sql

Although using @company.projects is useful for getting all of @company's projects, I've been having a problem getting at the projects owner. The reason is that rails returns a hash combining the projects and projects_companies tables. As both of these have a column named company_id, when I iterate through @company.projects and try to get at the company_id and hencethe project owner, I get the company_id from the join table and not the company_id from the projects table. I've toyed with the idea of removing the duplication by replacing company_id with owner in the Projects table but want to keep things as they are.

Find_by_sql to the rescue. I simply built the query I wanted using MySQL Query Browser and pasted that in et voila! - I get only the values from the Projects table.

Thursday, November 03, 2005

Securing urls

Using associations for security:


Instead of:

@project = Project.find(1)

do

@project = @company.project.find(1)

To hell with ACL

I've been racking my brains for the past few weeks while I've been trying to set up the front end of planlist. I've been convinced of the need for restricting access according to a certain heirarchy: account admin, project admin, partner admin. The fact that a user can be a project admin on one project while being a pleb on another menas that I've had to add attributes to my joins and have ended up with associations such as project habtm users, project bt user etc.
Anyway, I've just had a moment of enlightenment (a la basecamp): keep it simple. From now on there will be just 3 roles:

  • user in who's name account is held
    Can CRUD all company's projects, can U company information

  • users working for company owning project
    Can RU projects, CRUD partners

  • everyone else
    Can CRUD anything from THEIR company, unless their company is an account holder



The added advantage of all of this is ..... when creating a Project I don't need to create a User (owner) and the same goes for when I create a Company; the problems of validating a Company and User or Project and User at the same time vanish. My snazzy AJAX forms are no longer needed. Wallop. All this means that I've sort of got to start from scratch again ...