Refactor mock reporting data and class methods

All mock reporting data was moved to a JSON file. The concept of
what JEDI CLIN a particular environment drew money from was added to the
data.

This change had a cascade effect to the reporting class methods,
templates, and Vue components that ingested that reporting data. Many of
these files were modified to adapt to these changes. This also included
modifying the obligated funding bar graphs to reflect new design
changes.
This commit is contained in:
graham-dds
2019-12-09 09:20:31 -05:00
parent d9c79b9b58
commit dc9a21a501
11 changed files with 676 additions and 400 deletions

View File

@@ -1,4 +1,4 @@
from datetime import date, datetime, timedelta
from datetime import datetime
from flask import redirect, render_template, url_for, request as http_request, g
@@ -35,9 +35,6 @@ def create_portfolio():
@user_can(Permissions.VIEW_PORTFOLIO_REPORTS, message="view portfolio reports")
def reports(portfolio_id):
portfolio = Portfolios.get(g.current_user, portfolio_id)
today = date.today()
current_month = date(int(today.year), int(today.month), 15)
prev_month = current_month - timedelta(days=28)
# wrapped in str() because the sum of obligated funds returns a Decimal object
total_portfolio_value = str(
sum(
@@ -51,10 +48,10 @@ def reports(portfolio_id):
total_portfolio_value=total_portfolio_value,
current_obligated_funds=Reports.obligated_funds_by_JEDI_clin(portfolio),
expired_task_orders=Reports.expired_task_orders(portfolio),
monthly_totals=Reports.monthly_totals(portfolio),
monthly_spending=Reports.monthly_spending(portfolio),
current_month=current_month,
prev_month=prev_month,
now=datetime.now(), # mocked datetime of reporting data retrival
retrieved=datetime.now(), # mocked datetime of reporting data retrival
)