Skip to content

Commit

Permalink
Merge pull request #263 from cal-itp/use-check-order
Browse files Browse the repository at this point in the history
use reports_order field instead of hardcoded value
  • Loading branch information
owades authored Jun 28, 2023
2 parents e2c4bed + bc617ea commit 4346d3b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
16 changes: 5 additions & 11 deletions reports/generate_reports_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,32 +148,26 @@ def _guideline_check():
_.check,
_.reports_status,
_.is_manual,
_.reports_order,
)
>> collect()
)


def generate_guideline_check(itp_id: int, publish_date):
importance = [
"A GTFS Schedule feed is listed",
"GTFS schedule feed downloads successfully",
"No errors in MobilityData GTFS Schedule Validator",
"GTFS Schedule feed is published at a stable URI (permalink) from which it can be “fetched” automatically by trip-planning applications*",
"Includes an open license that allows commercial use of GTFS Schedule feed*",
"GTFS Schedule feed ingested by Google Maps and/or a combination of Apple Maps, Transit App, Bing Maps, Moovit or local Open Trip Planner services*",
]

guideline_check = (
_guideline_check()
>> filtr(_.organization_itp_id == itp_id)
>> filtr(_.publish_date == publish_date)
>> select(_.date_checked, _.check, _.reports_status, _.is_manual)
>> select(
_.date_checked, _.check, _.reports_status, _.is_manual, _.reports_order
)
>> mutate(
date_checked=_.date_checked.astype(str),
check=np.where(_.is_manual, _.check + "*", _.check),
)
>> spread(_.date_checked, _.reports_status)
>> arrange(_.check.apply(importance.index))
>> arrange(_.reports_order)
>> pipe(_.fillna(""))
)

Expand Down
8 changes: 4 additions & 4 deletions templates/report.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@
</th>

<th class="whitespace-nowrap">
{{ guideline_check["columns"][2] }}
{{ guideline_check["columns"][3] }}
</th>
<th class="whitespace-nowrap">
{{ guideline_check["columns"][3] }}
{{ guideline_check["columns"][4] }}
</th>
</tr>
</thead>
Expand All @@ -324,10 +324,10 @@
{{ row[0] }}
</td>
<td>
{{ show_check_status(row[2]) }}
{{ show_check_status(row[3]) }}
</td>
<td>
{{ show_check_status(row[3]) }}
{{ show_check_status(row[4]) }}
</td>
</tr>
{% endfor %}
Expand Down
18 changes: 18 additions & 0 deletions tests/schemas/schema_4_guideline_check.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "string"
},
Expand All @@ -71,6 +74,9 @@
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "string"
},
Expand All @@ -88,6 +94,9 @@
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "string"
},
Expand All @@ -105,6 +114,9 @@
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "string"
},
Expand All @@ -122,6 +134,9 @@
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "string"
},
Expand All @@ -139,6 +154,9 @@
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "string"
},
Expand Down

0 comments on commit 4346d3b

Please sign in to comment.