Repository: carpentries/amy

Issue:
Add functionality to verify if learner has previously filled out Instructor Training Request Form
I would like to suggest the addition of some way for a **learner who has just completed the Instructor Training Workshop to search the database and verify whether they have previously submitted Instructor Training Request Form.**

I believe I may have filled the form out a few months ago, but am unsure. I was told the easiest way to do that would be to send an email to checkout@carpentries.org, which I have. However, we might be able to reduce the checkout@carpentries.org's inbox burden a bit by doing this.


Discussion:
Did you receive a confirmation email after your first form submission?
No, did not find a confirmation email. I'll submit a new form to make sure.
@apaloczy how did it go? Do you think email confirmation is sufficient solution?

In my opinion, it's quite easy to implement (it already is implemented) and shifts the burden from admins / checkout managers onto applicants.

I'm not sure why you didn't receive your confirmation. Maybe you hit a timerange when our mailing service wasn't working, or maybe it's still broken.
@apaloczy is this issue still relevant?
*If* this is an easy implementation its not a bad idea to add something like this to the form in addition to the email. We get quite a few people submitting repeated applications when we ask at different points (before the workshop, during/after the workshop). I'm not sure how much that clutter matters -- it will be less of a problem for me once #1501  has been implemented. 
@karenword I'd go with confirmation email (and that's what is implemented). Having public access to the list of applicants is generally a bad idea.
Hi everyone, just caught up with the discussion. @karenword the reason for suggesting this was indeed to relieve admins from the burden, since on the applicant's end it's easy to just send a second email in case the first one doesn't go through. So in general I would go with implementing this new feature, but, if there are technical concerns as @pbanaszkiewicz points out, then I think sticking with the confirmation email sounds fine too.
I don't think this is direclty related to #1501 as it's not just the open applications that we end up getting multiple submissions.  People from member sites also re-submit when they are unsure if they already submitted.  

We'd also want to be sure to consider privacy issues.  How do we validate to someone whether they have submitted something without breaching privacy?  

There is also another concern about *why* they are re-submitting.  Is it because they are unsure if they already did? Is it because their circumstances changed and so they wanted to re-apply?

@pbanaszkiewicz Is it possible to send people a copy of their application, so they can look in their own email to confirm?  
@karenword   I would probably lean towards option 3 when it comes to fixing this. What do you think?


**Which of the following applies to when you want to see this fixed?**
1. Would like to see this fixed as soon as possible, in the next 1-2 development cycles (i.e., by September 2019)
2. Would like to see this fixed later (by the end of 2019)
3. Would like to see this fixed, but possibly as part of a larger project that needs more planning
4. Not sure
5. No longer relevant - OK to close
Perhaps we could start by adding functionality that would *identify* whether an application is a duplicate based on email matching? This would help me now. In the future, we could consider applicant communication about this as part of a larger project? Can I answer 1 and 3 on that basis, with 1 being based on the assumption that this is a relatively small task?
@maneesha:
> @pbanaszkiewicz Is it possible to send people a copy of their application, so they can look in their own email to confirm?

Yes, it's quite easy to implement. We already do so for the workshop request.

> We'd also want to be sure to consider privacy issues. How do we validate to someone whether they have submitted something without breaching privacy?

Maybe we should enable login/registration for these forms. Then we could enable preview of all submitted requests for these users.

@karenword:
> Perhaps we could start by adding functionality that would identify whether an application is a duplicate based on email matching? This would help me now. 

It's easy to implement a list of all other requests from the same email address on the page of specific request.
For the first phase of this, we would like to send people a copy of their application.

The second phase of this will require more consideration from The Carpentries instructor training team.  We can currently view [possible duplicate training requests](https://amy.carpentries.org/reports/duplicate_training_requests/) but we need to figure out what to do with them.  We don't necessarily want to merge them because the second application may reflect not just changes in basic information like contact information but also changes in experiences and skill set that they want reflected. 

Resolving patch:
diff --git a/amy/workshops/management/commands/fake_database.py b/amy/workshops/management/commands/fake_database.py
--- a/amy/workshops/management/commands/fake_database.py
+++ b/amy/workshops/management/commands/fake_database.py
@@ -246,6 +246,7 @@ def fake_training_request(self, person_or_None):
             state = 'a'
             person = person_or_None
 
+        registration_code = self.faker.city() if randbool(0.1) else ''
         occupation = choice(TrainingRequest._meta.get_field('occupation')
                                            .choices)[0]
         training_completion_agreement = randbool(0.5)
@@ -255,7 +256,8 @@ def fake_training_request(self, person_or_None):
         req = TrainingRequest.objects.create(
             state=state,
             person=person_or_None,
-            group_name=self.faker.city() if randbool(0.1) else '',
+            review_process='preapproved' if registration_code else 'open',
+            group_name=registration_code,
             personal=person.personal,
             middle='',
             family=person.family,


Test patch:
diff --git a/amy/extforms/tests/test_training_request_form.py b/amy/extforms/tests/test_training_request_form.py
--- a/amy/extforms/tests/test_training_request_form.py
+++ b/amy/extforms/tests/test_training_request_form.py
@@ -64,6 +64,7 @@ def test_request_added(self):
         self.assertEqual(msg.to, [email])
         self.assertEqual(msg.subject,
                          TrainingRequestCreate.autoresponder_subject)
+        self.assertIn('A copy of your request', msg.body)
         # with open('email.eml', 'wb') as f:
         #     f.write(msg.message().as_bytes())