Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

submitReport: Capture if the report was originally flagged for review. #275

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions vaccinate/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ def submit_report(request, on_request_logged):
# is_pending_review
if report_data["is_pending_review"] or user_should_have_reports_reviewed(reporter):
kwargs["is_pending_review"] = True
kwargs["originally_pending_review"] = True
else:
# Explicitly set as False, since the originally_pending_review
# field is nullable, so we know which reports were before we
# started logging.
kwargs["originally_pending_review"] = False

if bool(request.GET.get("test")) and request.GET.get("fake_timestamp"):
fake_timestamp = parser.parse(request.GET["fake_timestamp"])
if fake_timestamp.tzinfo is None:
Expand Down
1 change: 1 addition & 0 deletions vaccinate/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ class ReportAdmin(DynamicListDisplayMixin, admin.ModelAdmin):
readonly_fields = (
"created_at",
"created_at_utc",
"originally_pending_review",
"public_id",
"airtable_id",
"airtable_json",
Expand Down
21 changes: 21 additions & 0 deletions vaccinate/core/migrations/0076_report_originally_pending_review.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.1.8 on 2021-04-12 08:11

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("core", "0075_various_model_field_options"),
]

operations = [
migrations.AddField(
model_name="report",
name="originally_pending_review",
field=models.BooleanField(
help_text="Reports that were originally flagged as pending review",
null=True,
),
),
]
4 changes: 4 additions & 0 deletions vaccinate/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ class ReportSource(models.TextChoices):
is_pending_review = models.BooleanField(
default=False, help_text="Reports that are pending review by our QA team"
)
originally_pending_review = models.BooleanField(
null=True,
help_text="Reports that were originally flagged as pending review",
)
soft_deleted = models.BooleanField(
default=False,
help_text="we never delete rows from this table; all deletes are soft",
Expand Down
5 changes: 3 additions & 2 deletions vaccinate/core/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def test_custom_csv_export_for_reports(
report_source="ca",
appointment_tag=web,
is_pending_review=True,
originally_pending_review=True,
)
plus_65 = AvailabilityTag.objects.get(slug="vaccinating_65_plus")
plus_50 = AvailabilityTag.objects.get(slug="vaccinating_50_plus")
Expand All @@ -337,8 +338,8 @@ def test_custom_csv_export_for_reports(
csv_bytes = b"".join(chunk for chunk in response.streaming_content)
csv_string = csv_bytes.decode("utf-8")
assert csv_string == (
"id,location_id,location,is_pending_review,soft_deleted,soft_deleted_because,report_source,appointment_tag_id,appointment_tag,appointment_details,public_notes,internal_notes,reported_by_id,reported_by,created_at,call_request_id,call_request,airtable_id,airtable_json,public_id,availability_tags\r\n"
'{},{},Location 1,True,False,,ca,3,web,,,,{},auth0:reporter,{},,,,,{},"Vaccinating 65+, Vaccinating 50+"\r\n'.format(
"id,location_id,location,is_pending_review,originally_pending_review,soft_deleted,soft_deleted_because,report_source,appointment_tag_id,appointment_tag,appointment_details,public_notes,internal_notes,reported_by_id,reported_by,created_at,call_request_id,call_request,airtable_id,airtable_json,public_id,availability_tags\r\n"
'{},{},Location 1,True,True,False,,ca,3,web,,,,{},auth0:reporter,{},,,,,{},"Vaccinating 65+, Vaccinating 50+"\r\n'.format(
report.id,
report.location_id,
reporter.id,
Expand Down