Skip to content

Commit

Permalink
Merge pull request #1940 from CityOfPhiladelphia/ppr-fix
Browse files Browse the repository at this point in the history
Ppr fix
  • Loading branch information
m-atia committed Jul 19, 2023
2 parents 3c18508 + 21daf01 commit 9db4c9a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
jQuery(document).ready(function($) {
var featActivitiesQueryURL = 'https://phl.carto.com/api/v2/sql?q=SELECT *, ppr_programs.id as id, program_description_short as desc, facility->>0 as facility, gender->>0 as gender FROM ppr_programs INNER JOIN ppr_facilities ON ppr_facilities.id = ppr_programs.facility->>0 AND ppr_programs.program_is_featured AND ppr_programs.program_is_public AND ppr_programs.program_is_approved AND ppr_programs.program_is_active LIMIT 3'
var $activityCards = $('.ppr-feat-activity')
var featLocationTypesQueryURL = "https://phl.carto.com/api/v2/sql?q=SELECT count(*) AS count, regexp_replace(lower(ppr_location_types.location_type_name), ' ', '-', 'g') as slug, ppr_location_types.location_type_name, ppr_location_types.location_type_description, ppr_location_types.location_type_photo, ppr_location_types.id , ppr_location_types.location_type_is_published, ppr_location_types.location_type_is_featured FROM ppr_location_types AS ppr_location_types INNER JOIN ppr_facilities ON (ppr_facilities.location_type->>1 = ppr_location_types.id) INNER JOIN ppr_website_locatorpoints ON (ppr_facilities.website_locator_points_link_id = ppr_website_locatorpoints.linkid) WHERE ppr_location_types.location_type_is_published AND ppr_location_types.location_type_is_featured GROUP BY ppr_location_types.location_type_name, ppr_location_types.location_type_description, ppr_location_types.location_type_photo, ppr_location_types.id, ppr_location_types.location_type_is_published, ppr_location_types.location_type_is_featured LIMIT 6";
var featLocationTypesQueryURL = "https://phl.carto.com/api/v2/sql?q=WITH+facility_location_types_tmp+AS+(SELECT+jsonb_array_elements_text(location_type)+as+exploded_location_type+FROM+ppr_facilities+WHERE+(facility_is_published+%3D+true))+SELECT+count(*)+AS+count,+location_type_id+AS+id,+location_type_name+AS+name,+location_type_description+AS+description,+location_type_photo+AS+photo_id,+regexp_replace(regexp_replace(lower(trim(location_type_name)),+%27[%5Ea-zA-Z0-9]%27,+%27-%27,+%27g%27),+%27%5C-%5C-%2B%27,+%27-%27,+%27g%27)+AS+slug+FROM+facility_location_types_tmp+LEFT+JOIN+ppr_location_types+ON+(facility_location_types_tmp.exploded_location_type+%3D+ppr_location_types.id)+WHERE+(location_type_is_published+%3D+true)+GROUP+BY+location_type_id,+location_type_name,+location_type_description,+location_type_photo+ORDER+BY+count+DESC";
// var featLocationTypesQueryURL = "https://phl.carto.com/api/v2/sql?q=SELECT count(*) AS count, regexp_replace(lower(ppr_location_types.location_type_name), ' ', '-', 'g') as slug, ppr_location_types.location_type_name, ppr_location_types.location_type_description, ppr_location_types.location_type_photo, ppr_location_types.id , ppr_location_types.location_type_is_published, ppr_location_types.location_type_is_featured FROM ppr_location_types AS ppr_location_types INNER JOIN ppr_facilities ON (ppr_facilities.location_type->>1 = ppr_location_types.id) INNER JOIN ppr_website_locatorpoints ON (ppr_facilities.website_locator_points_link_id = ppr_website_locatorpoints.linkid) WHERE ppr_location_types.location_type_is_published AND ppr_location_types.location_type_is_featured GROUP BY ppr_location_types.location_type_name, ppr_location_types.location_type_description, ppr_location_types.location_type_photo, ppr_location_types.id, ppr_location_types.location_type_is_published, ppr_location_types.location_type_is_featured LIMIT 6";
var $locationTypeCards = $('.ppr-feat-locationType')

/**
Expand Down Expand Up @@ -95,7 +96,7 @@ jQuery(document).ready(function($) {
var locationTypes = data.rows
// 2. get Flickr image sizes for each location type
var photos = locationTypes.map(function(lType){
return getFlickrPhoto(lType.location_type_photo)
return getFlickrPhoto(lType.photo_id)
})

Promise.all(photos).then(locationPhotos =>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</a>
</div>
<a data-slug href="/parks-rec-finder/#/locations/">
<h4 data-location_type_name class="ppr-feat-locationType__name"></h4>
<h4 data-name class="ppr-feat-locationType__name"></h4>
</a>
<p data-location_type_description class="ppr-feat-locationType__desc"></p>
<p data-description class="ppr-feat-locationType__desc"></p>
<?php include(dirname(__FILE__).'/ppr-loader-svg.php'); ?>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
include(locate_template('partials/departments/ppr/ppr-feat-locationType-card.php'));
include(locate_template('partials/departments/ppr/ppr-feat-locationType-card.php'));
include(locate_template('partials/departments/ppr/ppr-feat-locationType-card.php'));
include(locate_template('partials/departments/ppr/ppr-feat-locationType-card.php'));
include(locate_template('partials/departments/ppr/ppr-feat-locationType-card.php'));
include(locate_template('partials/departments/ppr/ppr-feat-locationType-card.php'));
include(locate_template('partials/departments/ppr/ppr-feat-locationType-card.php'));
include(locate_template('partials/departments/ppr/ppr-feat-locationType-card.php'));
include(locate_template('partials/departments/ppr/ppr-feat-locationType-card.php'));
?>
</div>
</div>
Expand Down

0 comments on commit 9db4c9a

Please sign in to comment.