frePPLe / frepple

frePPLe - open source supply chain planning
https://frepple.com
Other
527 stars 252 forks source link

Fix getStorageUsage() total_size value, when there are no Scenario objects in database #669

Closed mdukat closed 2 months ago

mdukat commented 2 months ago

When running frePPLe for the first time, clicking Help->About FrePPLe will throw Server Error 500:

image

Following error log in apache, we can see:

image

And that's, because there are no Scenario objects in database, and fetchone() returns () tuple, which we cannot select first element from.

My fix only add's size value from fetchone(), if there is anything to add. Tested on latest master branch build:

image

jdetaeye commented 2 months ago

An empty scenario table is not a normal situation. We always try to keep it in sync with the configured databases. But it doesn't hurt to have this case covered as well.

mdukat commented 2 months ago

Cool, thank you.