diff --git a/pages/ot_requests.py b/pages/ot_requests.py index e2ad35656710..24dcfd1827a3 100644 --- a/pages/ot_requests.py +++ b/pages/ot_requests.py @@ -13,6 +13,7 @@ # limitations under the License. from api.converters import stage_to_json_dict +from internals.core_enums import OT_EXTENSION_STAGE_TYPES from internals.core_models import Stage from framework import basehandlers @@ -28,11 +29,27 @@ class OriginTrialsRequests(basehandlers.FlaskHandler): def get_template_data(self, **kwargs): stages_with_requests = Stage.query( Stage.ot_action_requested == True).fetch() - stages = [] + creation_stages = [] + extension_stages = [] for stage in stages_with_requests: stage_dict = stage_to_json_dict(stage) # Add the request note that is not typically visible to non-admins. if stage.ot_request_note: stage_dict['ot_request_note'] = stage.ot_request_note - stages.append(stage_dict) - return {'stages': stages} + # Group up creation and extension requests. + if stage_dict['stage_type'] in OT_EXTENSION_STAGE_TYPES: + # Information will be needed from the original OT stage. + ot_stage = Stage.get_by_id(stage_dict['ot_stage_id']) + ot_stage_dict = stage_to_json_dict(ot_stage) + # Supply both the OT stage and the extension stage. + extension_stages.append({ + 'ot_stage': ot_stage_dict, + 'extension_stage': stage_dict, + }) + else: + creation_stages.append(stage_dict) + + return { + 'creation_stages': creation_stages, + 'extension_stages': extension_stages, + } diff --git a/templates/admin/features/ot_requests.html b/templates/admin/features/ot_requests.html index b269fa373cde..98495aaf5b57 100644 --- a/templates/admin/features/ot_requests.html +++ b/templates/admin/features/ot_requests.html @@ -25,10 +25,10 @@

Copy row directly into "Trials - Validated" spreadsheet ( -{% for stage in stages %} +{% for stage in creation_stages %}

- Request for: {{stage.ot_display_name}} + Creation request for: {{stage.ot_display_name}} @@ -64,6 +64,21 @@

Additional comments:

{{stage.ot_request_note}}

{% endfor %} +{% for stage_info in extension_stages %} +
+

+ Extension request for: {{stage_info.ot_stage.ot_display_name}} +

+

Origin trial ID: {{stage_info.ot_stage.origin_trial_id}}

+
+

Intent to Extend Experiment: {{stage_info.extension_stage.intent_thread_url}}

+
+

New end milestone: {{stage_info.extension_stage.desktop_last}}

+
+

Additional comments: {{stage_info.extension_stage.ot_request_note}}

+
+
+{% endfor %} {% endblock %} {% block js %}