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

FIX: skip division if no additional criteria exist #238

Closed dave-mills closed 12 months ago

dave-mills commented 12 months ago

Bug report from user - when accessing the main organisation's 'show' page, they get a 500 error "division by zero".

Stack trace showed this as coming from the Assessment class => getAdditionalScoreAttribute(). It was assuming there was at least 1 additional criteria, even though the organisation in question doesn't have any.

I added a check to make sure the organisation is using additional criteria and that there is at least 1 additionalCriteria entry for the organisation to fix the issue.

Screenshot CleanShot 2023-11-15 at 11 34 24

dan-tang-ssd commented 12 months ago

I get latest code from dev branch. I can replicate the issue in my local env.

Testing in local env:

  1. Create an institution, tick the checkbox for additional criteria without adding any
  2. Create a portfolio, create an initiative
  3. Assess initative, it throws error after clicking "Finalise Assessment" button
  4. It shows the same error when I visit "My Institution" page

Screen shots:

image

image

image

dan-tang-ssd commented 12 months ago

I got latest code from this branch, the issue can be resolved by this branch. I think it is good to merge.