I believe this is a result of the team member's start and end dates being blank, on teams and users that were added to Nitro before this year's Create. When you edit a team on the web, the users' dates don't appear to be blank, but they are blank in the database.
[9] pry(main)> Time.now.between?(nil, Date.tomorrow)
ArgumentError: comparison of Time with nil failedValidations on PerformanceTeamUser
This was challenging to recreate locally, because the database snapshot on some of these tables doesn't match production. You may want to speak to Wade to get a full copy of these tables: PerformanceTeam, PerformanceTeamUser (I think it's just these two, but possibly other tables).
- Change the order of the validations. The web form does have a default date for each team member, even when you edit older teams where the team member doesn't have a start or end date.
- Backfill any blank start and end dates for users on these older teams. The start and end dates would match the start and end dates of the given user's team, which is the default for new teams. I believe filling in the empty dates would prevent the error where it's attempting to compare a date to an empty date value.
When you create a team, the mentor and leader have the same start and end dates as the team. The mentor (who is first in charge) stays with the team (if they leave Power, the team is disbanded).
But we want to allow leaders (who are actually the 2nd person in charge) to be promoted to mentors. That can happen in the middle of the quarter.
We should be able to edit the team leader's start and end dates, just like the other team members. The team_leader has a different type of database association than normal team members, so that should be taken into account (it may be necessary to add new start/end date columns, for example).
After a team is created, you can add and remove team members. This is done via javascript (to add and remove the relevant form fields).
The team member start and end dates uses the standard Nitro date picker. The date picker doesn't work when you initially add a team member. After the team member has been added and you hit submit, the date picker works. But the most likely time you'd use the date picker is when you add the team member.