fix(heuristic): replace hardcoded 75% usability with real calculation#1859
fix(heuristic): replace hardcoded 75% usability with real calculation#1859Harshit2405-2004 wants to merge 4 commits intoruxailab:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes the heuristic dashboard’s “General usability” card to display a computed usability percentage based on real evaluator answers from the Vuex testAnswerDocument, replacing the previous hardcoded 75% placeholder (closes #1852).
Changes:
- Compute
usabilityPercentageinUsabilityResults.vueby aggregating evaluator answers and averaging per-evaluator percentages. - Add a new unit test suite validating the computed percentage across several edge cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/ux/Heuristic/components/manager/UsabilityResults.vue |
Replaces hardcoded usability score with a computed score derived from Vuex answer data and test options. |
tests/unit/heuristic/UsabilityResults.spec.js |
Adds unit tests for the new usability-percentage calculation and edge cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…handling - Filter non-finite values before computing maxOption to prevent NaN - Use Number.isFinite guard on answer values for robust extraction - Handle null and undefined answers as N/A alongside -1 sentinel - Add 3 new test cases for null, undefined, and mixed N/A scenarios Resolves review comments on PR ruxailab#1859
axios uses ESM import syntax which Jest cannot parse without transforming. Add transformIgnorePatterns to exclude axios from the default node_modules ignore list so babel-jest can convert it to CJS. Fixes CI test failure on Node 24 LTS.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|



Description
Closes #1852
The
UsabilityResults.vuedashboard card always displayed a hardcoded 75% usability score regardless of actual evaluator responses. This PR replaces the placeholder with a real calculation that reads answer data from the Vuex store and computes the true usability percentage.What changed
src/ux/Heuristic/components/manager/UsabilityResults.vueuseStore()from Vuex to access answer data viastore.getters.testAnswerDocumentreturn 75inusabilityPercentagecomputed property with real logic:heuristicAnswersmaxOptionfromprops.test.testOptions{value, text}object answers and raw number answersvalue === -1)(sum × 100) / ((totalQ − totalNA) × maxOption)tests/unit/heuristic/UsabilityResults.spec.js(new file)testAnswerDocument→0%heuristicAnswers→0%testOptions→0%0%(noNaNorInfinity)Screenshot
Edge cases handled
testAnswerDocumentisnullor missingheuristicAnswerstestOptionsisnull,undefined, or empty arraymaxOptionis0or negative0evaluators inheuristicAnswers-1) — prevents division by zero{value, text}vs raw number)Validation
npm testnpx eslint UsabilityResults.vuenpm run build-prodFiles changed
src/ux/Heuristic/components/manager/UsabilityResults.vue— 45 insertions, 3 deletionstests/unit/heuristic/UsabilityResults.spec.js— 136 insertions (new file)