0

Users can join projects.

Projects can have many tasks.

Each user completes the task at their own time, they can also have some other user specific settings on the task like the priority in their todo list and whether to hide it on completion or not.

enter image description here

The problem I'm facing is that some of these settings must have default values e.g. priority = 0, hideOnComplete = true.

These must be available to the client for each project user at all times. How do I make that the TaskUser rows with the default values for the each user exist at all times?

Option A:

  • I create a TaskUser relation for every user in the project each time a new task is added to the project.

  • I create a new TaskUser relation for each task in the project every time a new user joins the project.

I don't think this is the way to go since you have to be reacting to these events all the time and acting in response.

Option B:

Duplicate the default fields in the Task table. I include a priority and hideOnComplete field in the Task table. The client can then know what what to display on Task setting forms even if the TaskUser relation doesn't exist.

I no longer have to react to new users or tasks. A client can request the task object and populate the settings form with the default fields even when there is no TaskUser relation. Afterwards, when the users submits his own settings the client can look into the existing TaskUser relation for the correct values.

This seems to be a much better option to me. What do you think?

  • Does every User in the Project choose whether they want to hideOnComplete every Task? Does every User in the Project have a priority for every Task? – Joe Borysko Jun 1 '15 at 22:24
  • There are default values for these properties, e.g. hideOnComplete = true, priority = 0. But a user can choose to change these values, e.g. mike decides he doesn't like it when his tasks disappear on complete but john does. – RedHusky Jun 2 '15 at 20:12
  • What I need clarification on is 1) whether the priority for a particular task can be different amongst different users and 2) whether the hideOnComplete for a single task can be different between different users (i.e. Mike completes Task A, it doesn't hide for Mike but does hide for John). – Joe Borysko Jun 2 '15 at 22:54
  • TLDR: Yes to both 1) and 2) these attributes can be different for the same task between users. Maybe Projects/tasks wasn't the best way to represent this. Since usually a task in a project only needs to be completed once by anyone in the project (School Course/Assignments would've been better). In my version a task is assigned to each user in the project and therefore User A might prioritize the task 'clean your desk' as 0 and complete it on wednesday while User B prioritizes it as 4 and completes it on monday. – RedHusky Jun 3 '15 at 20:06
0

In your scenario, since (if I'm understanding correctly), every User will need to complete every Task in the Projects they belong to, there will need to be one UserTask per Task per User if you want to store things such as dateCompleted.

Because of this, Option A makes sense to me. You need to be "reacting to these events all the time and acting in response" anyway. One modification I would make though is that I would include a defaultHideOnComplete field in the User table. The TaskUser's hideOnComplete field would be initially set to the defaultHideOnComplete value for the User associated with it.

Option B doesn't make sense to me with what you're trying to accomplish, because it doesn't allow for every User to set their own hideOnComplete and priority values.

Let me know if I'm misunderstanding something : ]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.