mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 10:03:21 -04:00
Updated activity chart to include additional day (#2862)
This commit is contained in:
@@ -421,7 +421,7 @@ def redact_mobile_number(mobile_number, spacing=""):
|
|||||||
return "".join(mobile_number_list)
|
return "".join(mobile_number_list)
|
||||||
|
|
||||||
|
|
||||||
def get_time_left(created_at, service_data_retention_days=7):
|
def get_time_left(created_at, service_data_retention_days=8):
|
||||||
return ago.human(
|
return ago.human(
|
||||||
(datetime.now(timezone.utc))
|
(datetime.now(timezone.utc))
|
||||||
- (
|
- (
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ def get_filtered_jobs(service_id, page):
|
|||||||
@main.route("/activity/services/<uuid:service_id>")
|
@main.route("/activity/services/<uuid:service_id>")
|
||||||
@user_has_permissions(ServicePermission.VIEW_ACTIVITY)
|
@user_has_permissions(ServicePermission.VIEW_ACTIVITY)
|
||||||
def all_jobs_activity(service_id):
|
def all_jobs_activity(service_id):
|
||||||
service_data_retention_days = 7
|
service_data_retention_days = 8
|
||||||
page = get_page_from_request()
|
page = get_page_from_request()
|
||||||
|
|
||||||
jobs = get_filtered_jobs(service_id, page)
|
jobs = get_filtered_jobs(service_id, page)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ def service_dashboard(service_id):
|
|||||||
return redirect(url_for("main.choose_template", service_id=service_id))
|
return redirect(url_for("main.choose_template", service_id=service_id))
|
||||||
|
|
||||||
job_response = job_api_client.get_jobs(service_id)["data"]
|
job_response = job_api_client.get_jobs(service_id)["data"]
|
||||||
service_data_retention_days = 7
|
service_data_retention_days = 8
|
||||||
|
|
||||||
active_jobs = [
|
active_jobs = [
|
||||||
job for job in job_response if job["job_status"] != JobStatus.CANCELLED
|
job for job in job_response if job["job_status"] != JobStatus.CANCELLED
|
||||||
@@ -55,7 +55,7 @@ def service_dashboard(service_id):
|
|||||||
messages_remaining = total_messages.get("messages_remaining", 0)
|
messages_remaining = total_messages.get("messages_remaining", 0)
|
||||||
messages_sent = total_messages.get("messages_sent", 0)
|
messages_sent = total_messages.get("messages_sent", 0)
|
||||||
all_statistics = template_statistics_client.get_template_statistics_for_service(
|
all_statistics = template_statistics_client.get_template_statistics_for_service(
|
||||||
service_id, limit_days=7
|
service_id, limit_days=8
|
||||||
)
|
)
|
||||||
template_statistics = aggregate_template_usage(all_statistics)
|
template_statistics = aggregate_template_usage(all_statistics)
|
||||||
return render_template(
|
return render_template(
|
||||||
@@ -361,7 +361,7 @@ def get_stats_date_range():
|
|||||||
current_financial_year = get_current_financial_year()
|
current_financial_year = get_current_financial_year()
|
||||||
current_month = get_current_month_for_financial_year(current_financial_year)
|
current_month = get_current_month_for_financial_year(current_financial_year)
|
||||||
start_date = datetime.now().strftime("%Y-%m-%d")
|
start_date = datetime.now().strftime("%Y-%m-%d")
|
||||||
days = 7
|
days = 8
|
||||||
return {
|
return {
|
||||||
"current_financial_year": current_financial_year,
|
"current_financial_year": current_financial_year,
|
||||||
"current_month": current_month,
|
"current_month": current_month,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</form>
|
</form>
|
||||||
<div id="activityChart">
|
<div id="activityChart">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-subtitle">{{ current_service.name }} - last 7 days</div>
|
<div class="chart-subtitle">{{ current_service.name }}</div>
|
||||||
<div class="chart-legend" role="region" aria-label="Legend"></div>
|
<div class="chart-legend" role="region" aria-label="Legend"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-container" id="weeklyChart"></div>
|
<div class="chart-container" id="weeklyChart"></div>
|
||||||
|
|||||||
@@ -694,10 +694,11 @@ def test_doesnt_show_pagination_with_search_term(
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("job_created_at", "expected_message"),
|
("job_created_at", "expected_message"),
|
||||||
[
|
[
|
||||||
("2016-01-10 11:09:00.000000+00:00", "Data available for 7 days"),
|
("2016-01-10 11:09:00.000000+00:00", "Data available for 8 days"),
|
||||||
("2016-01-04 11:09:00.000000+00:00", "Data available for 1 day"),
|
("2016-01-04 11:09:00.000000+00:00", "Data available for 2 days"),
|
||||||
("2016-01-03 11:09:00.000000+00:00", "Data available for 12 hours"),
|
("2016-01-03 11:09:00.000000+00:00", "Data available for 1 day"),
|
||||||
("2016-01-02 23:59:59.000000+00:00", "Data no longer available"),
|
("2016-01-02 11:09:00.000000+00:00", "Data available for 12 hours"),
|
||||||
|
("2016-01-01 23:59:59.000000+00:00", "Data no longer available"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@freeze_time("2016-01-10 12:00:00.000000")
|
@freeze_time("2016-01-10 12:00:00.000000")
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ def test_should_show_recent_templates_on_dashboard(
|
|||||||
service_id=SERVICE_ONE_ID,
|
service_id=SERVICE_ONE_ID,
|
||||||
)
|
)
|
||||||
|
|
||||||
mock_template_stats.assert_called_once_with(SERVICE_ONE_ID, limit_days=7)
|
mock_template_stats.assert_called_once_with(SERVICE_ONE_ID, limit_days=8)
|
||||||
|
|
||||||
headers = [
|
headers = [
|
||||||
header.text.strip() for header in page.find_all("h2") + page.find_all("h1")
|
header.text.strip() for header in page.find_all("h2") + page.find_all("h1")
|
||||||
@@ -394,7 +394,7 @@ def test_should_not_show_recent_templates_on_dashboard_if_only_one_template_used
|
|||||||
page = client_request.get("main.service_dashboard", service_id=SERVICE_ONE_ID)
|
page = client_request.get("main.service_dashboard", service_id=SERVICE_ONE_ID)
|
||||||
main = page.select_one("main").text
|
main = page.select_one("main").text
|
||||||
|
|
||||||
mock_template_stats.assert_called_once_with(SERVICE_ONE_ID, limit_days=7)
|
mock_template_stats.assert_called_once_with(SERVICE_ONE_ID, limit_days=8)
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
stats[0]["template_name"] == "one"
|
stats[0]["template_name"] == "one"
|
||||||
|
|||||||
@@ -467,10 +467,11 @@ def test_should_show_updates_for_scheduled_job_as_json(
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("job_created_at", "expected_message"),
|
("job_created_at", "expected_message"),
|
||||||
[
|
[
|
||||||
("2016-01-10 11:09:00.000000+00:00", "Data available for 7 days"),
|
("2016-01-10 11:09:00.000000+00:00", "Data available for 8 days"),
|
||||||
("2016-01-04 11:09:00.000000+00:00", "Data available for 1 day"),
|
("2016-01-04 11:09:00.000000+00:00", "Data available for 2 days"),
|
||||||
("2016-01-03 11:09:00.000000+00:00", "Data available for 12 hours"),
|
("2016-01-03 11:09:00.000000+00:00", "Data available for 1 day"),
|
||||||
("2016-01-02 23:59:59.000000+00:00", "Data no longer available"),
|
("2016-01-02 11:09:00.000000+00:00", "Data available for 12 hours"),
|
||||||
|
("2016-01-01 23:59:59.000000+00:00", "Data no longer available"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@freeze_time("2016-01-10 12:00:00.000000")
|
@freeze_time("2016-01-10 12:00:00.000000")
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ beforeAll(done => {
|
|||||||
</form>
|
</form>
|
||||||
<div id="activityChart" >
|
<div id="activityChart" >
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-subtitle">Service Name - last 7 days</div>
|
<div class="chart-subtitle">Service Name - last 8 days</div>
|
||||||
<div class="chart-legend" role="region" aria-label="Legend"></div>
|
<div class="chart-legend" role="region" aria-label="Legend"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-container" id="weeklyChart" data-service-id="12345" style="width: 600px;"></div>
|
<div class="chart-container" id="weeklyChart" data-service-id="12345" style="width: 600px;"></div>
|
||||||
@@ -313,7 +313,7 @@ test('handleDropdownChange shows empty message when user has no jobs', () => {
|
|||||||
<tr><td data-sender="Another User">Another User</td></tr>
|
<tr><td data-sender="Another User">Another User</td></tr>
|
||||||
<tr><td data-sender="Different User">Different User</td></tr>
|
<tr><td data-sender="Different User">Different User</td></tr>
|
||||||
<tr class="table-row">
|
<tr class="table-row">
|
||||||
<td class="table-empty-message" colspan="10">No batched job messages found (messages are kept for 7 days).</td>
|
<td class="table-empty-message" colspan="10">No batched job messages found (messages are kept for 8 days).</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user