From c158e9fc3509e67e902819f6948b6d8a1cdccacd Mon Sep 17 00:00:00 2001 From: dandds Date: Mon, 10 Sep 2018 16:23:27 -0400 Subject: [PATCH 1/4] wire request review log for ccpo review screen --- atst/models/request_review.py | 8 ++++ atst/routes/requests/approval.py | 1 + templates/requests/approval.html | 82 +++++++++++++------------------- 3 files changed, 41 insertions(+), 50 deletions(-) diff --git a/atst/models/request_review.py b/atst/models/request_review.py index 3c991ea5..9c1361d2 100644 --- a/atst/models/request_review.py +++ b/atst/models/request_review.py @@ -20,3 +20,11 @@ class RequestReview(Base): phone_mao = Column(String) fname_ccpo = Column(String) lname_ccpo = Column(String) + + @property + def full_name_mao(self): + return "{} {}".format(self.fname_mao, self.lname_mao) + + @property + def full_name_ccpo(self): + return "{} {}".format(self.fname_ccpo, self.lname_ccpo) diff --git a/atst/routes/requests/approval.py b/atst/routes/requests/approval.py index ca02933f..321f6869 100644 --- a/atst/routes/requests/approval.py +++ b/atst/routes/requests/approval.py @@ -35,6 +35,7 @@ def render_approval(request, form=None): return render_template( "requests/approval.html", data=data, + statuses=request.status_events, request_id=request.id, status=request.status.value, pending_review=pending_review, diff --git a/templates/requests/approval.html b/templates/requests/approval.html index 8cf4ec2c..2011d482 100644 --- a/templates/requests/approval.html +++ b/templates/requests/approval.html @@ -142,60 +142,42 @@
    -
  1. -
    -
    -

    Denied by Darth Vader

    -

    "You have failed me for the last time, Admiral. Captain Piett. Yes, my lord. Make ready to land out troops beyond the energy shield and deploy the fleet so that nothing gets off that system."

    -
    -
    -

    Mission Owner approval on behalf of:

    - Grand Moff Tarkin - tarkin@empire.mil - (234) 567-8901 + {% for status in statuses %} + {% if status.review %} +
  2. +
    +
    +

    Denied by Darth Vader

    + {% if status.review.comment %} +

    {{ status.review.comment }}

    + {% endif %} + +
    + {% if status.review.lname_mao %} +
    +

    Mission Owner approval on behalf of:

    + {{ status.review.full_name_mao }} + {{ status.review.email_mao }} + {{ status.review.phone_mao }} +
    + {% endif %} + + {% if status.review.lname_ccpo %} +
    +

    CCPO approval on behalf of:

    + {{ status.review.full_name_ccpo }} +
    + {% endif %} +
    - -
    -

    CCPO approval on behalf of:

    - Emperor Palpatine - palpatine@empire.mil - (345) 678-9012 -
    -
  3. -
    - -
    -
    -
  4. +
    + + + {% endif %} + {% endfor %} -
  5. -
    -
    -

    Denied by Darth Vader

    -

    "You have failed me for the last time, Admiral. Captain Piett. Yes, my lord. Make ready to land out troops beyond the energy shield and deploy the fleet so that nothing gets off that system."

    - -
    -
    -

    Mission Owner approval on behalf of:

    - Grand Moff Tarkin - tarkin@empire.mil - (234) 567-8901 -
    - -
    -

    CCPO approval on behalf of:

    - Emperor Palpatine - palpatine@empire.mil - (345) 678-9012 -
    -
    -
    - -
    -
    -
From 570d3b69f30f1660164dc517b4531cb289012c02 Mon Sep 17 00:00:00 2001 From: dandds Date: Mon, 10 Sep 2018 16:59:47 -0400 Subject: [PATCH 2/4] display reviewer name and basic review action --- atst/models/request_review.py | 4 ++++ atst/models/request_status_event.py | 9 +++++++++ atst/routes/requests/approval.py | 2 +- templates/requests/approval.html | 6 +++--- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/atst/models/request_review.py b/atst/models/request_review.py index 9c1361d2..c46f1d11 100644 --- a/atst/models/request_review.py +++ b/atst/models/request_review.py @@ -21,6 +21,10 @@ class RequestReview(Base): fname_ccpo = Column(String) lname_ccpo = Column(String) + @property + def full_name_reviewer(self): + return self.reviewer.full_name + @property def full_name_mao(self): return "{} {}".format(self.fname_mao, self.lname_mao) diff --git a/atst/models/request_status_event.py b/atst/models/request_status_event.py index a5373bdd..15e8a3d1 100644 --- a/atst/models/request_status_event.py +++ b/atst/models/request_status_event.py @@ -42,3 +42,12 @@ class RequestStatusEvent(Base): @property def displayname(self): return self.new_status.value + + @property + def log_name(self): + if self.new_status == RequestStatus.CHANGES_REQUESTED: + return "Denied" + elif self.new_status == RequestStatus.PENDING_FINANCIAL_VERIFICATION: + return "Accepted" + else: + return self.displayname diff --git a/atst/routes/requests/approval.py b/atst/routes/requests/approval.py index 321f6869..1f1659cf 100644 --- a/atst/routes/requests/approval.py +++ b/atst/routes/requests/approval.py @@ -35,7 +35,7 @@ def render_approval(request, form=None): return render_template( "requests/approval.html", data=data, - statuses=request.status_events, + statuses=reversed(request.status_events), request_id=request.id, status=request.status.value, pending_review=pending_review, diff --git a/templates/requests/approval.html b/templates/requests/approval.html index 2011d482..fbef27e8 100644 --- a/templates/requests/approval.html +++ b/templates/requests/approval.html @@ -148,7 +148,7 @@
  • -

    Denied by Darth Vader

    +

    {{ status.log_name }} by {{ status.review.full_name_reviewer }}

    {% if status.review.comment %}

    {{ status.review.comment }}

    {% endif %} @@ -171,13 +171,13 @@ {% endif %}
    -
    + {% set timestamp=status.time_created.strftime("%Y-%m-%d %H:%M:%S %Z") %} +
  • {% endif %} {% endfor %} - From 81bf0181e27042364af46280445c50e82de742ce Mon Sep 17 00:00:00 2001 From: dandds Date: Tue, 11 Sep 2018 09:45:15 -0400 Subject: [PATCH 3/4] use filter for ccpo approval log timestamp --- atst/filters.py | 4 ++-- templates/requests/approval.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/atst/filters.py b/atst/filters.py index 47ac3afc..b0ceda9c 100644 --- a/atst/filters.py +++ b/atst/filters.py @@ -65,9 +65,9 @@ def renderList(value): return app.jinja_env.filters["safe"]("
    ".join(value)) -def formattedDate(value): +def formattedDate(value, formatter="%m/%d/%Y"): if value: - return value.strftime("%m/%d/%Y") + return value.strftime(formatter) else: return "-" diff --git a/templates/requests/approval.html b/templates/requests/approval.html index fbef27e8..f65222d9 100644 --- a/templates/requests/approval.html +++ b/templates/requests/approval.html @@ -171,7 +171,7 @@ {% endif %} - {% set timestamp=status.time_created.strftime("%Y-%m-%d %H:%M:%S %Z") %} + {% set timestamp=status.time_created | formattedDate("%Y-%m-%d %H:%M:%S %Z") %}
    From 6b869cccead5153f7853dbade32a9732fdc15acc Mon Sep 17 00:00:00 2001 From: dandds Date: Tue, 11 Sep 2018 11:04:37 -0400 Subject: [PATCH 4/4] clarify status variable names in ccpo approval template --- atst/routes/requests/approval.py | 4 ++-- templates/requests/approval.html | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/atst/routes/requests/approval.py b/atst/routes/requests/approval.py index 1f1659cf..ebb4126e 100644 --- a/atst/routes/requests/approval.py +++ b/atst/routes/requests/approval.py @@ -35,9 +35,9 @@ def render_approval(request, form=None): return render_template( "requests/approval.html", data=data, - statuses=reversed(request.status_events), + status_events=reversed(request.status_events), request_id=request.id, - status=request.status.value, + current_status=request.status.value, pending_review=pending_review, financial_review=pending_final_approval, pdf_available=request.task_order and request.task_order.pdf, diff --git a/templates/requests/approval.html b/templates/requests/approval.html index f65222d9..f29814fc 100644 --- a/templates/requests/approval.html +++ b/templates/requests/approval.html @@ -20,7 +20,7 @@

    Request #{{ request_id }}

    - {{ status }} + {{ current_status }}
    @@ -143,35 +143,35 @@
      - {% for status in statuses %} - {% if status.review %} + {% for status_event in status_events %} + {% if status_event.review %}
    1. -

      {{ status.log_name }} by {{ status.review.full_name_reviewer }}

      - {% if status.review.comment %} -

      {{ status.review.comment }}

      +

      {{ status_event.log_name }} by {{ status_event.review.full_name_reviewer }}

      + {% if status_event.review.comment %} +

      {{ status_event.review.comment }}

      {% endif %}
      - {% if status.review.lname_mao %} + {% if status_event.review.lname_mao %}

      Mission Owner approval on behalf of:

      - {{ status.review.full_name_mao }} - {{ status.review.email_mao }} - {{ status.review.phone_mao }} + {{ status_event.review.full_name_mao }} + {{ status_event.review.email_mao }} + {{ status_event.review.phone_mao }}
      {% endif %} - {% if status.review.lname_ccpo %} + {% if status_event.review.lname_ccpo %}

      CCPO approval on behalf of:

      - {{ status.review.full_name_ccpo }} + {{ status_event.review.full_name_ccpo }}
      {% endif %}
      - {% set timestamp=status.time_created | formattedDate("%Y-%m-%d %H:%M:%S %Z") %} + {% set timestamp=status_event.time_created | formattedDate("%Y-%m-%d %H:%M:%S %Z") %}