SAEON / national-climate-change-response-database

Suite of services - for tracking, analysing, and monitoring climate adaptation and mitigation projects
MIT License
1 stars 2 forks source link

Two bugs identified by Malebo Rebecca Seeletse #69

Closed zachsa closed 1 year ago

zachsa commented 1 year ago

I noticed that even after I have approved projects on the public interface the number is not updating. The accepted mitigation projects number from the admin site is not the same as the one for the public.

Secondly when I download the data I get a CSV file that contains information on about a "502" server error instead of projects

zachsa commented 1 year ago

Identified the download error:

node:events:490
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot destructure property 'grid1' of 'fixGridValues(...)' as it is undefined.
    at default (file:///home/zach/code/saeon/repositories/national-climate-change-response-database/src/api/src/http/download-submissions/parse-row/parse-progress-data/index.js:15:11)
    at parseValue (file:///home/zach/code/saeon/repositories/national-climate-change-response-database/src/api/src/http/download-submissions/parse-row/index.js:67:35)
    at default (file:///home/zach/code/saeon/repositories/national-climate-change-response-database/src/api/src/http/download-submissions/parse-row/index.js:156:14)
    at Request.<anonymous> (file:///home/zach/code/saeon/repositories/national-climate-change-response-database/src/api/src/http/download-submissions/index.js:138:36)
    at Request.emit (node:events:512:28)
    at Request.<anonymous> (/home/zach/code/saeon/repositories/national-climate-change-response-database/src/api/node_modules/mssql/lib/tedious/request.js:631:20)
    at Request.emit (node:events:512:28)
    at Request.emit (/home/zach/code/saeon/repositories/national-climate-change-response-database/src/api/node_modules/tedious/lib/request.js:150:18)
    at RequestTokenHandler.onRow (/home/zach/code/saeon/repositories/national-climate-change-response-database/src/api/node_modules/tedious/lib/token/handler.js:457:20)
    at Readable.<anonymous> (/home/zach/code/saeon/repositories/national-climate-change-response-database/src/api/node_modules/tedious/lib/token/token-stream-parser.js:26:33)
Emitted 'error' event on Readable instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v19.8.1
zachsa commented 1 year ago

Regarding the download error, there is a submission that contains an invalid 'endDate' for the emissions progress calculator. I've improved error handling to allow for this and similar problems. In this case, in the download if a calculator or other field has an error the form content then the details of this error will be included in the cell instead of the value.

The problematic submission is here: http://nccrd.environment.gov.za/submissions/CC3E433E-F36B-1410-867E-00528B626FB9

zachsa commented 1 year ago

Regarding the differences in the counts, I am not able to reproduce the bug. I have tried the following:

With 2 windows open (one as admin, one as incognito)