Update grade report card rendering logic#70
Conversation
Refactor grade report rendering to conditionally display grade cards based on violations.
|
Hi @Natan-gal, Thanks for the Pull Request! Before we merge it, I have two requests:
To fix this, instead of checking the number of violations, simply check if the report object for the specific scanner (cost, security, or container) actually exists. Please update this condition for all three scanners and let me know when you are done! |
Fixed the scanner card rendering logic. Previously, cards were hidden when the number of violations was 0, which also hid scanners that actually ran successfully with a perfect score. Now the cards are rendered based on whether the scanner report object exists, so: * scanners with 0 violations are still visible, * scanners that did not run stay hidden, * Overall Grade is only shown when more than one scanner result exists. Closes SolDevelo#53
|
Updated the rendering conditions to check whether the scanner report object exists instead of checking the number of violations. This now correctly displays scanners with 0 violations while still hiding scanners that did not run. Closes #53 |
|
I tested the changes locally and noticed that when only the cost scanner is enabled, the Security and Container cards are still rendered with It looks like disabled scanners may still produce empty/default report objects, which makes the new existence-based rendering condition evaluate to Could you verify whether skipped scanners should omit their report objects entirely instead of generating empty reports? |
|
I've implemented the fixes for both issues: Backend Fix (reporter/grading.py):
Frontend Fix (static/app.js):
Both commits address your original feedback and the rendering condition issue. Ready for review! |
|
I tried running the application locally with: python3 app.pybut encountered an It looks like the issue is caused by incorrect indentation after one of the function definitions ( Could you verify whether the application was tested locally after the latest changes? At the moment the app does not start on my side because of this indentation issue. |
Added traceback import and improved error handling with detailed error messages.
Natan-gal
left a comment
There was a problem hiding this comment.
After testing the app locally, I fixed the issues related to single-scanner report handling and several NoneType crashes.
The updated logic now correctly handles partial scans (fast, security, containers) and the application works as expected during local testing.
Main fixes include:
- safe handling for missing grade objects
- fixes for
.letterandseverity_breakdownaccess onNone - improved overall grade calculation for partial scans
- corrected rendering for single-scanner results
|
Hi @Natan-gal, Thanks for the updates and for testing this locally! The application no longer crashes with single-scanner runs, which is great. However, during my review, I found a few issues that need to be addressed before we can merge this: 1. Broken HTML Layout in
|
* restored missing `grade-report-section` wrapper * restored Infrastructure Health Report section title * fixed orphaned closing </div> breaking DOM layout * preserved single-scanner rendering logic * ensured recommendations section renders correctly
* restored missing `grade-report-section` wrapper * restored Infrastructure Health Report section title * fixed orphaned closing </div> breaking DOM layout * preserved single-scanner rendering logic * ensured recommendations section renders correctly
Changes