Skip to content

Commit

Permalink
Merge pull request #3431 from CityOfBoston/develop
Browse files Browse the repository at this point in the history
(stage) Fix for API to Correct 311 Mobile App Status of City Services DIG-4340
  • Loading branch information
davidrkupton authored Apr 25, 2024
2 parents fc88471 + 6969108 commit e9b5bec
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 33 deletions.
98 changes: 94 additions & 4 deletions .github/percy/snapshot_config_stage.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,101 @@
- name: Article - Testpage
url: https://d8-dev.boston.gov/departments/digital-team/test-page
- name: Article with ALL components
url: https://d8-stg.boston.gov/departments/digital-team/test-page
waitForTimeout: 5000
execute: |
jQuery('.paragraphs-item-events-and-notices').addClass("hidden");
- name: Landing Page - METROLIST
url: https://d8-dev.boston.gov/node/11565196
- name: Event (basic) - WEST END COMMUNITY PRESERVATION
url: https://d8-stg.boston.gov/node/61556

- name: Event (with header) - MAYOR ON MAIN TROLLEY TOUR
url: https://d8-stg.boston.gov/node/45361

- name: Listing Page - PAY AND APPLY
url: https://d8-stg.boston.gov/node/32906

- name: Listing Page - PARKS AND PLAYGROUNDS
url: https://d8-stg.boston.gov/node/32946

- name: Place Profile - ANIMAL CARE AND CONTROL CENTER
url: https://d8-stg.boston.gov/node/2191

- name: Place Profile - BAY VILLAGE HISTORIC DISTRICT
url: https://d8-stg.boston.gov/node/3251

- name: Person Profile - MARK CIOMMO
url: https://d8-stg.boston.gov/node/401

- name: Person Profile - KIM JANEY
url: https://d8-stg.boston.gov/node/38046

- name: Program Initiative Page - MY BROTHERS KEEPER BOSTON
url: https://d8-stg.boston.gov/node/7396

- name: Program Initiative Page - AGE-FRIENDLY BOSTON
url: https://d8-stg.boston.gov/node/25396

- name: Post - BIKE SHARE
url: https://d8-stg.boston.gov/node/1741

- name: Post - RODENT AND PEST CONTROL
url: http://d8-stg.boston.gov/node/63036

- name: How To - CPR TRAINING
url: https://d8-stg.boston.gov/node/3606
execute: |
jQuery('.dr-tr:last()').click();
# Expands last drawer on page

- name: How To - FILE FOR A PROPERTY TAX ABATEMENT
url: https://d8-stg.boston.gov/node/12806
execute: |
jQuery('.dr-tr:last()').click();
# Expands last drawer on page

- name: Article - PARKING METERS
url: https://d8-stg.boston.gov/node/551

- name: Article - MAYORS OFFICE OF HOUSING
url: https://d8-stg.boston.gov/node/2726

- name: Department - INSPECTIONAL SERVICES
url: https://d8-stg.boston.gov/node/151
execute: |
jQuery('.paragraphs-item-events-and-notices').addClass("hidden");
# Hides dynamic content on page to reduce false positives for changes

- name: Department - HUMAN RESOURCES
url: https://d8-stg.boston.gov/node/216
execute: |
jQuery('.dr-c:first()').;
# Expands first drawer on page

- name: Public Notice - PUBLIC FACILITIES COMMISSION MEETING
url: https://d8-stg.boston.gov/node/64966

- name: Guide - GETTING AROUND BOSTON
url: https://d8-stg.boston.gov/node/506

- name: Guide - HAVING A CAR IN BOSTON
url: https://d8-stg.boston.gov/node/6

- name: Landing Page - HOMEPAGE
url: https://d8-stg.boston.gov/node/21
execute: |
jQuery('.dr-tr:last()').click();
# Expands first drawer on page

- name: Landing Page - CAREER CENTER
url: https://d8-stg.boston.gov/node/19261
execute: |
jQuery('.paragraphs-item-grid-of-cards:first()').addClass("hidden");
# Hides dynamic content on page to reduce false positives for changes

- name: Procurement - INSPECTIONAL SERVICES RELATIVE TO ...
url: https://d8-stg.boston.gov/node/15920681

- name: Procurement - BFD THERMAL IMAGING CAMERAS ...
url: https://d8-stg.boston.gov/node/15920521

- name: Map Verification - 30 Westville St (BH)
url: https://d8-stg.boston.gov/buildinghousing/30-westville-st
2 changes: 1 addition & 1 deletion .github/workflows/percy_snapshot_static_stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: Bhacaz/checkout-files@v2
with:
files: .github/percy
branch: master
branch: develop
- name: Setup Node 16
uses: actions/setup-node@v3
with:
Expand Down
7 changes: 2 additions & 5 deletions config/default/views.view.public_notice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ display:
- 'languages:language_interface'
- url
- url.query_args
- user
- 'user.node_grants:view'
- user.permissions
tags: { }
Expand Down Expand Up @@ -901,7 +900,7 @@ display:
exclude: false
alter:
alter_text: true
text: '{{ field_public_notice_date_1__value|date_modify("-5 hours")|date("h:ia") }}{% if field_public_notice_date_1__end_value %} to {{ field_public_notice_date_1__end_value|date_modify("-5 hours")|date("h:ia") }}{% endif %}'
text: '{{ field_public_notice_date_1__value|date_modify("-0 hours")|date("h:ia", "America/Anchorage") }}{% if field_public_notice_date_1__end_value %} to {{ field_public_notice_date_1__end_value|date_modify("-0 hours")|date("h:ia", "America/Anchorage") }}{% endif %}'
make_link: false
path: ''
absolute: false
Expand Down Expand Up @@ -941,7 +940,7 @@ display:
click_sort_column: value
type: daterange_default
settings:
timezone_override: Pacific/Honolulu
timezone_override: America/Anchorage
format_type: date_format_calendar_time
separator: ''
group_column: value
Expand Down Expand Up @@ -1584,7 +1583,6 @@ display:
- 'languages:language_interface'
- url
- url.query_args
- user
- 'user.node_grants:view'
- user.permissions
tags: { }
Expand All @@ -1604,7 +1602,6 @@ display:
- 'languages:language_interface'
- url
- url.query_args
- user
- 'user.node_grants:view'
- user.permissions
tags: { }
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public function render() {
// Get the feed output.
$feed = json_decode(parent::render());

// Reformat the feed output.
// Reformat the feed output, aggregating the language variants into a
// single row per status_item.
foreach($feed as $status_item) {

!empty($output[$status_item->id]) ?: $output[$status_item->id] = [];
Expand Down Expand Up @@ -86,19 +87,17 @@ public function render() {

case "show":
case "published_at":
// Only use published and show fields from the base (en) variant.
// Only use published field from the base (en) variant.
if ($status_item->language == "en") {
$output[$status_item->id][$field] = str_ireplace("\n", "", $value);
$output[$status_item->id][$field] = strip_tags(str_ireplace("\n", "", $value));
}
break;

case "changed":
// Make sure the most recent publish date is recorded.
if (!isset($output[$status_item->id][$field])) {
$output[$status_item->id][$field] = str_ireplace("\n", "", $value);
}
elseif (date(str_ireplace("\n", "", $value)) > date($output[$status_item->id][$field])) {
$output[$status_item->id][$field] = str_ireplace("\n", "", $value);
// Make sure the most recent update date is recorded.
$date = strip_tags(str_ireplace("\n", "", $value));
if (strtotime($date) > strtotime($output[$status_item->id]["updated_at"]??"2000-01-01")) {
$output[$status_item->id]["updated_at"] = $date;
}
break;

Expand All @@ -111,31 +110,21 @@ public function render() {
}

// Enabled flag will only be true if:
// - The node is Published and the Node is has field_enabled = True.
// - The node is Published and the Node has field_enabled = True.
if ($status_item->language == "en") {
$output[$status_item->id]["enabled"] = ($status_item->enabled == "True") && ($status_item->isPublished == "True");
$output[$status_item->id]["enabled"] = (($status_item->enabled == "True") && ($status_item->isPublished == "True"));
// Convert to a string.
$output[$status_item->id]["enabled"] = ($output[$status_item->id]["enabled"] ? "True" : "False");
}

}

// Now calculate the last updated date/time.
// Now cleanup the output.
foreach($output as $key => &$row) {

if (count($row) == 0) {
unset($output[$key]);
continue;
}

$row["updated_at"] = $row["changed"];
if (!empty($row["show"]) && !empty($row["changed"])) {
$row["updated_at"] = $row["changed"];
if (date($row["show"]) > date($row["changed"])) {
$row["updated_at"] = $row["show"];
}
}
$row["published_at"] = $row["updated_at"];

unset($row["show"]); // redundant
unset($row["changed"]); // redundant
unset($row["isPublished"]); // redundant
Expand Down

0 comments on commit e9b5bec

Please sign in to comment.