Skip to content
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

Enforce membership code on instructor training application #2544

Conversation

elichad
Copy link
Contributor

@elichad elichad commented Oct 13, 2023

Fixes #2379.

Adds code enforcement to the instructor training application in a similar way to workshop requests.

I changed the group_name field to member_code for consistency between TrainingRequest and CommonRequest, and because I think it's much clearer given the terminology we're using currently.

@elichad elichad added this to the v4.3 milestone Oct 13, 2023
@elichad elichad self-assigned this Oct 13, 2023
@elichad
Copy link
Contributor Author

elichad commented Oct 13, 2023

@karenword a couple of questions for you about member code validation on the instructor training application. You don't need to look at the code changes in this PR.

Validation

Initially we discussed having a "soft" validation where the user is prompted to check their code is correct, but will still be allowed to submit an invalid code. However, this turns out to be difficult to implement in the Django code framework that we use, and I'd prefer not to do it if we can avoid it.

Here's how I've currently implemented the validation for different reasons for the invalid code:

  • Code doesn't match a membership - raises an error, can't submit
  • Request submission date is outside of relevant membership dates (+ 90 days either side) - raises an error, can't submit
  • Membership has no seats remaining - no error, can submit, the request should be flagged on the admin side instead (my thought being that it's harder for a member contact to determine/debug if they've overused seats, and a trainee might not understand how this works)

What are your thoughts on this? Is this too restrictive?

I noticed that the application form currently says at the top "If you do not have a registration code, please enter the name of the institution you are joining through." Is this still accurate and expected, or should preapproved trainees always now have a code? If this statement is still true, we can't do the validation as I've described and will have to figure out the softer way.

Error message

Here's the error message I've written:

This code is invalid. This may be due to a typo, an expired code, or a code that has not yet been activated. Please confirm that you have copied the code correctly, or your site contact to verify your code.

I used the phrase "site contact" because it's at the top of the form too, but I haven't seen it elsewhere - if we have a more commonly used term for member-contact-from-trainee's-perspective, let me know.

This is a bit different to Maneesha's original suggestion as the validation style is changed. Let me know any feedback you have.

@karenword
Copy link

thanks for the heads up @elichad -- this is definitely a significant change and will take some thought. I will ping @Talishask and @klbarnes20 for feedback as well as putting this on our team meeting agenda for discussion next Tuesday.

@klbarnes20
Copy link
Contributor

My first impression is that this will lead to a lot of people being unable to submit (and thus a lot of confused emails). I regularly get messages that codes are expired or have already used all their seats when I'm connecting training requests to trainings. But definitely interested in what @Talishask has to say as well.

Copy link
Contributor

@pbanaszkiewicz pbanaszkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me.

amy/extforms/forms.py Outdated Show resolved Hide resolved
amy/extforms/forms.py Outdated Show resolved Hide resolved
@@ -88,6 +90,7 @@ class Meta:
}

def __init__(self, *args, **kwargs):
self.request_http = kwargs.pop("request", None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is a little bit off. Usually it was named self.request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this to avoid ambiguity between the http request and the training request that this form describes. I'm not entirely happy with the break from convention but I think it might prevent future confusion

amy/extforms/tests/test_training_request_form.py Outdated Show resolved Hide resolved
amy/extforms/forms.py Outdated Show resolved Hide resolved
amy/extforms/forms.py Outdated Show resolved Hide resolved
@elichad
Copy link
Contributor Author

elichad commented Oct 17, 2023

Summary of conversation with @karenword and @Talishask:

  • Soft validation is strongly preferred ([Member codes] Implement soft validation for member codes #2535)
  • If soft validation is not possible
    • do not apply hard validation
    • Keep internal matching to support attendance workflow, where possible
    • Still would like filter to identify invalid codes on the training requests page

Sentence at the top of the application form: If you do not have a registration code, please enter the name of the institution you are joining through.

  • We can remove this from the first paragraph.

Error message phrasing options:

  • This code is invalid. This may be due to a typo, an expired code, or a code that has not yet been activated. Please confirm that you have copied the code correctly, or confirm the code with the Membership Contact for your group
  • This code is invalid. This may be due to a typo, an expired code, or a code that has not yet been activated. Please confirm that you have copied the code correctly, or ask the Membership Contact to verify your code for your group

I am going to merge this PR after addressing @pbanaszkiewicz's recommendations, as there is code here that lays useful groundwork for further development. However, things will be changed on the validation side in future PRs according to the summary above.

@elichad elichad merged commit cad326e into feature/member-codes Oct 18, 2023
2 checks passed
@elichad elichad deleted the feature/2379-Enforce-membership-code-on-instructor-training-application branch October 18, 2023 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

4 participants