Skip to content

Instantly share code, notes, and snippets.

@gregblake
Last active June 18, 2019 14:00
Show Gist options
  • Select an option

  • Save gregblake/9be764ac05ead314cfc6082ba14284b5 to your computer and use it in GitHub Desktop.

Select an option

Save gregblake/9be764ac05ead314cfc6082ba14284b5 to your computer and use it in GitHub Desktop.
Marketing Teams Handoff

Marketing Teams

Date Range Issue

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.

Sentry Exception

[9] pry(main)> Time.now.between?(nil, Date.tomorrow)
ArgumentError: comparison of Time with nil failed

Validations 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).

Two potential solutions:
  1. 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.
  2. 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.

Team Leader Omission

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.

Potential Solution:

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).


Date Picker UI Glitch

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment