The ProjectsUser represents a user’s subscription to a project. A subscribed user can have one team or more based on his number of attempts to this project. Be careful to always select the active team (the last team).
Here are basically the different states a user can have on a project:
- He (the user) doesn’t have a projects_user, he is not registered on the project.
- He has no team, he is actually searching a group, in order to create one.
- He has a team, which is not locked (the
locked_at
field is not null), he is creating a group.
If the user has a locked team, then either he did, or he is doing the project. At this point, the available states are:
- His team is closed and has a final_mark (the
locked_at
,closed_at
andfinal_mark
fields aren’t null), he has finished his project. If he doesn’t have a final_mark yet, he his waiting for evaluation. - His team is not closed yet (and obviously doesn’t have a final mark), he is in progress.
Some exceptional cases happen when a project has children (like piscines), or begins at a specific time (like rushes).
- The team is locked, but the project has a
begin_at
field which starts is in the future, so he his waiting to start. - The team is locked, but the project has children. In this case, look at the teams on the child projects, and consider this one in progress.