Repository: carpentries/amy

Issue:
Add +1 to Instructor Training auto-score for Chemistry
If "areas of expertise" includes "Chemistry" Instructor Training applicants should now receive a +1 on their application auto-score.




Discussion:
@karenword  Is this still relevant?  If so, do you see this as a one time change, or will we change how autoscoring works on a regular basis, depending on the communities we want to engage?  

**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)  *I would think it would be this option if it's a one time change*
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  *I would think it would be this option if we see the need to make changes to autoscoring regularly*
4. Not sure
5. No longer relevant - OK to close

An answer of "1 for now and 3 long term" is also perfectly acceptable!



I believe this is still relevant and will continue to see changes regularly (hence option 3) but tagging @ErinBecker because I submitted this PR at her request.

1. We have a grant obligation to build a community in Chemistry. There may be changes to this scoring in the future, but at the scale of 6mo-1yr, so I'd rather make this as a "one time" change and not worry about a general solution right now.

Resolving patch:
diff --git a/amy/workshops/models.py b/amy/workshops/models.py
--- a/amy/workshops/models.py
+++ b/amy/workshops/models.py
@@ -1779,10 +1779,12 @@ def recalculate_score_auto(self):
         if self.underresourced:
             score += 1
 
-        # economics or social sciences, arts, humanities, or library science
+        # economics or social sciences, arts, humanities, library science, or
+        # chemistry
         scoring_domains = [
             'Humanities', 'Library and information science',
             'Economics/business', 'Social sciences',
+            'Chemistry',
         ]
         for domain in self.domains.all():
             if domain.name in scoring_domains:


Test patch:
diff --git a/amy/extrequests/tests/test_training_request.py b/amy/extrequests/tests/test_training_request.py
--- a/amy/extrequests/tests/test_training_request.py
+++ b/amy/extrequests/tests/test_training_request.py
@@ -148,10 +148,34 @@ def test_domains(self):
         domains = KnowledgeDomain.objects.filter(name__in=[
             'Humanities', 'Library and information science',
             'Economics/business', 'Social sciences',
+            'Chemistry',
         ])
         self.tr.domains.set(domains)
         self.assertEqual(self.tr.score_auto, 1)
 
+    def test_each_domain(self):
+        "Ensure each domain from the list counts for +1 score_auto."
+        domain_names = [
+            'Humanities',
+            'Library and information science',
+            'Economics/business',
+            'Social sciences',
+            'Chemistry',
+        ]
+
+        last_domain = None
+
+        for name in domain_names:
+            # we need to remove last domain added, but we can't use `.clear`
+            # because it doesn't trigger the m2m_changed signal
+            if last_domain:
+                self.tr.domains.remove(last_domain)
+
+            self.assertEqual(self.tr.score_auto, 0, name)
+            last_domain = KnowledgeDomain.objects.get(name=name)
+            self.tr.domains.add(last_domain)
+            self.assertEqual(self.tr.score_auto, 1, name)
+
     def test_underrepresented(self):
         """With change in https://github.com/swcarpentry/amy/issues/1468,
         we start automatically scoring underrepresented field."""