From 1d3bd354ed6b94fad847bd9fca9c34b58748b61b Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 2 Dec 2019 20:04:25 +0000 Subject: [PATCH 1/2] add Time Critical option in compose page --- observation_portal/requestgroups/serializers.py | 12 +++++++----- observation_portal/requestgroups/test/test_api.py | 8 ++++---- static/js/components/requestgroup.vue | 6 ++++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/observation_portal/requestgroups/serializers.py b/observation_portal/requestgroups/serializers.py index 006fe462..eff54cc4 100644 --- a/observation_portal/requestgroups/serializers.py +++ b/observation_portal/requestgroups/serializers.py @@ -787,20 +787,22 @@ def validate(self, data): if time_available <= 0.0: raise serializers.ValidationError( - _("Proposal {} does not have any time left allocated in semester {} on {} instruments").format( - data['proposal'], tak.semester, tak.instrument_type) + _("Proposal {} does not have any {} time left allocated in semester {} on {} instruments").format( + data['proposal'], data['observation_type'], tak.semester, tak.instrument_type) ) elif time_available * OVERHEAD_ALLOWANCE < (duration / 3600.0): raise serializers.ValidationError( - _("Proposal {} does not have enough time allocated in semester {}").format( - data['proposal'], tak.semester) + _("Proposal {} does not have enough {} time allocated in semester {}").format( + data['proposal'], data['observation_type'], tak.semester) ) # validate the ipp debitting that will take place later if data['observation_type'] == RequestGroup.NORMAL: validate_ipp(data, total_duration_dict) except ObjectDoesNotExist: raise serializers.ValidationError( - _("You do not have sufficient time allocated on the instrument you're requesting for this proposal.") + _("You do not have sufficient {} time allocated on the instrument you're requesting for this proposal.".format( + data['observation_type'] + )) ) except TimeAllocationError as e: raise serializers.ValidationError(repr(e)) diff --git a/observation_portal/requestgroups/test/test_api.py b/observation_portal/requestgroups/test/test_api.py index 091f6a37..a9138757 100644 --- a/observation_portal/requestgroups/test/test_api.py +++ b/observation_portal/requestgroups/test/test_api.py @@ -207,7 +207,7 @@ def test_post_requestgroup_no_time_allocation_for_instrument(self): bad_data['requests'][0]['configurations'][0]['instrument_configs'][0]['optical_elements']['slit'] = 'slit_6.0as' response = self.client.post(reverse('api:request_groups-list'), data=bad_data) self.assertEqual(response.status_code, 400) - self.assertIn('You do not have sufficient time', str(response.content)) + self.assertIn('You do not have sufficient NORMAL time', str(response.content)) def test_post_requestgroup_manual_instrument_not_allowed(self): bad_data = self.generic_payload.copy() @@ -246,7 +246,7 @@ def test_post_requestgroup_not_enough_time_allocation_for_instrument(self): self.time_allocation_1m0_sbig.save() response = self.client.post(reverse('api:request_groups-list'), data=bad_data) self.assertEqual(response.status_code, 400) - self.assertIn('does not have enough time allocated', str(response.content)) + self.assertIn('does not have enough NORMAL time allocated', str(response.content)) def test_post_requestgroup_not_enough_rr_time_allocation_for_instrument(self): bad_data = self.generic_payload.copy() @@ -257,7 +257,7 @@ def test_post_requestgroup_not_enough_rr_time_allocation_for_instrument(self): self.time_allocation_1m0_sbig.save() response = self.client.post(reverse('api:request_groups-list'), data=bad_data) self.assertEqual(response.status_code, 400) - self.assertIn('does not have enough time allocated', str(response.content)) + self.assertIn('does not have enough RAPID_RESPONSE time allocated', str(response.content)) def test_post_requestgroup_rr_future_start_time(self): bad_data = self.generic_payload.copy() @@ -291,7 +291,7 @@ def test_post_requestgroup_not_have_any_time_left(self): self.time_allocation_1m0_sbig.save() response = self.client.post(reverse('api:request_groups-list'), data=bad_data) self.assertEqual(response.status_code, 400) - self.assertIn('does not have any time left allocated', str(response.content)) + self.assertIn('does not have any NORMAL time left allocated', str(response.content)) def test_post_requestgroup_time_limit_reached(self): self.membership.time_limit = 0 diff --git a/static/js/components/requestgroup.vue b/static/js/components/requestgroup.vue index 2d51fbf8..6147ced7 100644 --- a/static/js/components/requestgroup.vue +++ b/static/js/components/requestgroup.vue @@ -78,11 +78,13 @@ label="Mode" field="observation_type" v-on:input="update" desc="Rapid Response (RR) requests bypass normal scheduling and are executed immediately. - This mode is only available if a proposal was granted RR time." + Time Critical (TC) requests are given a large fixed priority that will beat any Normal requests. + These mode are only available if a proposal was granted RR or TC time." :errors="errors.observation_type" :options="[ {value: 'NORMAL', text: 'Queue scheduled (default)'}, - {value:'RAPID_RESPONSE', text: 'Rapid Response'} + {value: 'TIME_CRITICAL', text: 'Time Critical'}, + {value: 'RAPID_RESPONSE', text: 'Rapid Response'} ]" @input="update" /> From b917da9c860f1027c9218b7d7b5d7eca44213308 Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 2 Dec 2019 20:24:15 +0000 Subject: [PATCH 2/2] fixed some wording --- static/js/components/requestgroup.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/components/requestgroup.vue b/static/js/components/requestgroup.vue index 6147ced7..3a39dc41 100644 --- a/static/js/components/requestgroup.vue +++ b/static/js/components/requestgroup.vue @@ -78,8 +78,9 @@ label="Mode" field="observation_type" v-on:input="update" desc="Rapid Response (RR) requests bypass normal scheduling and are executed immediately. - Time Critical (TC) requests are given a large fixed priority that will beat any Normal requests. - These mode are only available if a proposal was granted RR or TC time." + Time Critical (TC) requests are given a large fixed priority that will beat any + requests that use default queue scheduling. + These modes are only available if a proposal was granted RR or TC time." :errors="errors.observation_type" :options="[ {value: 'NORMAL', text: 'Queue scheduled (default)'},