stats4sd / aec_portfolio

A proof of concept for the AEC Consortium Project Management / Assessment System
GNU General Public License v3.0
0 stars 0 forks source link

[BUG] Error Occurred When Importing Projects #291

Closed dan-tang-ssd closed 4 days ago

dan-tang-ssd commented 5 days ago

User reported that there is an error when importing projects via excel file.

Possible cause:

  1. There is no new column added for "exchange_rate_eur" in project import excel template file
  2. The column "exchange_rate_eur" is existed in excel template file, user has not filled in value for it

Sentry error details: image


Sentry error: https://stats4sd-53.sentry.io/issues/5862315128/?alert_rule_id=15326462&alert_timestamp=1726564215216&alert_type=email&environment=production&notification_uuid=f18d3893-32bc-4a36-a4f9-59b9716d59cc&project=4507611585642496&referrer=alert_email


User reported email: image

dan-tang-ssd commented 5 days ago

At the beginning, I thought it could be the excel template file has not been updated to live env.

I downloaded the excel file in staging env and live env, both of them without the new column exchange_rate_eur.

After checking PR #251, #262, the excel template file has be merged into dev branch and main branch respeectively.

I downloaded it from Github main branch and dev branch, they have exchange_rate_eur column. That means the PRs have updated this excel file successfully.

Probably the excel file in remote server has not been updated due to some reason. I downloaded it from remote server staging site and live site, the excel file has the new column.

So... excel file has been updated during deployment. It looks like Laravel has cached the excel file so it returns the old file in "Import Initiatives" page.

I tried below commands in staging env, none of them can help...

php artisan config:clear

php artisan route:clear

php artisan cache:clear

php artisan view:clear

I suspect it may be due to browser cache, I tried Firefox, Chrome, Edge but all of them downloaded the old excel file. It looks like Laravel cached the excel file in some way...

I will search internet for potential solution and keep updating here.


Screen shots: image

dave-mills commented 5 days ago

@dan-tang-ssd - I don't think the static Excel sheet is what is used for that template. Looking at the code linked to that button, It was intended to be slightly customised for each organisation, so there is an export class that is used with the $organisation passed as a prop: App\Exports\InitiativeImportTemplate\InitiativeImportTemplateExportSheet

But looking at it, I see that it is not currently customised for the organisation. I can see an easy place where it should be (the currency should be, by default, the org's currency), but we didn't get that far. I also notice there is no budget_eur defined in that export class.