BiologicalRecordsCentre / PoMS

repository for Pollinator Monitoring Scheme website
0 stars 0 forks source link

Report not loading #166

Closed kitenetter closed 10 months ago

kitenetter commented 10 months ago

This page appears to have gone wrong - the data is not fully loading: https://ukpoms.org.uk/select-samples-species-data

Same problem here: https://ukpoms.org.uk/select-samples-bycatch-data

andrewvanbreda commented 10 months ago

@johnvanbreda Are you able to look at this. This page hasn't changed for 3 years so I think the Warehouse code has issue.

You do have a login on that website, let me know if you can't remember credentials.

I think actually looking at this, the rows the report is reporting are wrong because the survey_id is not being included in the report anymore. I think some the rows are from iRecord general data but should be survey 638

The report the page is running is projects/PoMS/select_samples_to_add_insect_data projects/PoMS/select_samples_to_add_insect_data_mapping

The warehouse was trying to execute the following SELECT s.id as "sample_id", snf.website_title || ' | ' || case when substring(snf.survey_title from 1 for length(snf.website_title)) = snf.website_title then trim(substring(snf.survey_title from length(snf.website_title)+1)) else snf.survey_title end as "source", s.location_name as "location_name", l.code as "location_code", l.centroid_sref as "location_sref", snf.public_entered_sref as "entered_sref", s.date_start as "date_start", s.date_end as "date_end", s.date_type as "date_type", null as date, snf.recorders as "recorder", s.created_by_id as "created_by_id", s.record_status as "record_status", CASE WHEN CAST(s.created_by_id AS character varying) = '84948' AND s.website_id IN (136) THEN true ELSE false END as "belongs_to_user", CASE WHEN s.website_id IN (136) THEN true ELSE false END as "belongs_to_site", case when s.input_form is null then '' else s.input_form end as "input_form", snf.attrs_json->>'1093' as attr_sample_1093 FROM cache_samples_functional s JOIN cache_samples_nonfunctional snf ON snf.id=s.id LEFT JOIN locations l on l.id=s.location_id and l.deleted=false JOIN system sys ON sys.id=1

WHERE s.training=false AND (s.website_id in (136) OR s.created_by_id=1 OR s.blocked_sharing_tasks IS NULL OR NOT s.blocked_sharing_tasks @> ARRAY['R'::character ]) AND ((trim('-2023') = '0' OR '-2023'='' OR s.date_end >= CAST((0-(-2023)::int)::text || '-01-01' as date)) AND (trim('-2023') = '0' OR '-2023'='' OR s.date_start

ORDER BY s.id DESC LIMIT 21

johnvanbreda commented 10 months ago

Unfortunately the fixes I needed to deploy on the warehouse to fix your report the other day meant that any incorrectly set up report parameters might stop working. I'd checked the reports folders and also the occurrences standard parameters, but missed a few in the sample standard parameters. Now fixed - will deploy to the warehouse once the CI tests are done.

johnvanbreda commented 10 months ago

Now deployed and fixed. Please close if OK (as I can't).

andrewvanbreda commented 10 months ago

@johnvanbreda Thanks. Looks like it is working, and the reports that were fixed other day are still working also. @kitenetter please close if you are happy with the data you are seeing now.

kitenetter commented 10 months ago

@andrewvanbreda as far as I can see the two report pages linked above are now functioning again. However, if you use the Edit link from the species data entry page it is going back to the old version of the species form, i.e. we've lost the new grids that separate out the bees and hoverflies.

andrewvanbreda commented 10 months ago

Hi @kitenetter I think this is behaving correctly. The new page with separate grids is on my test site and is not live yet. As noted in this issue am waiting for confirmation before I put that page live. https://github.com/BiologicalRecordsCentre/PoMS/issues/163 The test site page is still present here https://avb-scratch-ceh-ukpoms-d10.pantheonsite.io/species-data-entry

kitenetter commented 10 months ago

Apologies @andrewvanbreda I had forgotten that you were awaiting confirmation to go live. Closing this issue.