New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #1007 -- small improvements to training request workflow #1030
Conversation
Until now, pending requests can't be matched with a person and accepted requests must be matched with a person. Now, pending requests can't be matched with a *training* and accepted requests may or may not be matched with a training. It doesn't matter whether a request is matched with a person.
because it's unaligned with other buttons due to using custom layout.
Looks good to me - please merge when you're ready. |
('p', 'Pending'), # initial state | ||
('a', 'Accepted'), # state after matching a Person record | ||
('d', 'Discarded'), | ||
) | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why a list rather than a tuple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because here it's more readable to write:
[('', 'Pending or accepted')] + TrainingRequest.STATES
rather than
(('', 'Pending or accepted'),) + TrainingRequest.STATES
if self.state == 'p' and self.person is not None \ | ||
and self.person.get_training_tasks().exists(): | ||
raise ValidationError({'state': 'Pending training request cannot ' | ||
'be matched with a training.'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch 👍
('p', 'Pending'), # initial state | ||
('a', 'Accepted'), # state after matching a Person record | ||
('d', 'Discarded'), | ||
) | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a list rather than a tuple?
raise ValidationError({'person': 'Pending training requests cannot ' | ||
'be matched to a person.'}) | ||
if self.state == 'p' and self.person is not None \ | ||
and self.person.get_training_tasks().exists(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - thanks.
Looks good to me - please merge when you're ready. |
No description provided.