refactor: simplify code-example-evaluator route model loading#3701
refactor: simplify code-example-evaluator route model loading#3701rohitpaulk wants to merge 1 commit intomainfrom
Conversation
Test Results 1 files ±0 1 suites ±0 6m 48s ⏱️ +2s For more details on these errors, see this check. Results for commit 431f831. ± Comparison against base commit 156d356. ♻️ This comment has been updated with latest results. |
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
| @action | ||
| async handleDidInsert() { | ||
| await this.loadEvaluationsTask.perform(); | ||
| } |
There was a problem hiding this comment.
handleDidInsert method is never called from template
High Severity
The handleDidInsert method is defined to trigger loadEvaluationsTask, but there is no corresponding {{did-insert this.handleDidInsert}} modifier in the template. This means the evaluations are never fetched, leaving the passEvaluations, failEvaluations, and unsureEvaluations arrays permanently empty.
|
Bugbot Autofix prepared fixes for 2 of the 2 bugs found in the latest run.
Or push these changes by commenting: Preview (ab009fed8e)diff --git a/app/templates/course-admin/code-example-evaluator.hbs b/app/templates/course-admin/code-example-evaluator.hbs
--- a/app/templates/course-admin/code-example-evaluator.hbs
+++ b/app/templates/course-admin/code-example-evaluator.hbs
@@ -1,4 +1,4 @@
-<div class="bg-white dark:bg-gray-950 min-h-screen">
+<div class="bg-white dark:bg-gray-950 min-h-screen" {{did-insert this.handleDidInsert}}>
<div class="container mx-auto pt-4 pb-32 px-6">
<div class="py-3 border-b border-gray-200 dark:border-white/5 mb-6">
<TertiaryLinkButton @route="course-admin.code-example-evaluators" @models={{array @model.course.slug}} @size="small" class="pl-1.5 mb-3">
@@ -56,9 +56,9 @@
<CourseAdmin::CodeExampleEvaluatorPage::EvaluationsSection
@evaluator={{@model.evaluator}}
- @passEvaluations={{@model.passEvaluations}}
- @failEvaluations={{@model.failEvaluations}}
- @unsureEvaluations={{@model.unsureEvaluations}}
+ @passEvaluations={{this.passEvaluations}}
+ @failEvaluations={{this.failEvaluations}}
+ @unsureEvaluations={{this.unsureEvaluations}}
class="mt-8"
/>
</div> |
Bundle ReportChanges will increase total bundle size by 932 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: client-array-pushAssets Changed:
Files in
|
721dda9 to
d669964
Compare
| @action | ||
| async handleDidInsert() { | ||
| await this.loadEvaluationsTask.perform(); | ||
| } |
There was a problem hiding this comment.
Evaluations don't reload when query params change
High Severity
The loadEvaluationsTask is only triggered via handleDidInsert, which fires once when the element is inserted. The route has refreshModel: true for languages and course_stage_slugs query params, so the model updates when filters change, but the controller's task won't re-run. Previously, evaluations were loaded in the route's model() hook, which ran on every query param change. Now, changing language or course stage filters won't refresh the evaluations list.
|
Bugbot Autofix prepared fixes for 2 of the 2 bugs found in the latest run.
Or push these changes by commenting: Preview (54931e2d67)diff --git a/app/templates/course-admin/code-example-evaluator.hbs b/app/templates/course-admin/code-example-evaluator.hbs
--- a/app/templates/course-admin/code-example-evaluator.hbs
+++ b/app/templates/course-admin/code-example-evaluator.hbs
@@ -1,4 +1,4 @@
-<div class="bg-white dark:bg-gray-950 min-h-screen">
+<div class="bg-white dark:bg-gray-950 min-h-screen" {{did-insert this.handleDidInsert}} {{did-update this.handleDidInsert @model}}>
<div class="container mx-auto pt-4 pb-32 px-6">
<div class="py-3 border-b border-gray-200 dark:border-white/5 mb-6">
<TertiaryLinkButton @route="course-admin.code-example-evaluators" @models={{array @model.course.slug}} @size="small" class="pl-1.5 mb-3">
@@ -56,9 +56,9 @@
<CourseAdmin::CodeExampleEvaluatorPage::EvaluationsSection
@evaluator={{@model.evaluator}}
- @passEvaluations={{@model.passEvaluations}}
- @failEvaluations={{@model.failEvaluations}}
- @unsureEvaluations={{@model.unsureEvaluations}}
+ @passEvaluations={{this.passEvaluations}}
+ @failEvaluations={{this.failEvaluations}}
+ @unsureEvaluations={{this.unsureEvaluations}}
class="mt-8"
/>
</div> |
d669964 to
c49e9b4
Compare
c49e9b4 to
29f4d5b
Compare
Remove loading and filtering of evaluation subsets (pass, fail, unsure, trusted) and drop helper methods for building filters and loading evaluations. Load all languages instead of filtered languages. Streamline the model method to simplify data requirements and reduce complexity. This change improves maintainability by removing unused filtering logic and unused related types.
29f4d5b to
431f831
Compare



Remove loading and filtering of evaluation subsets (pass, fail, unsure,
trusted) and drop helper methods for building filters and loading evaluations.
Load all languages instead of filtered languages. Streamline the model method
to simplify data requirements and reduce complexity. This change improves
maintainability by removing unused filtering logic and unused related types.
Note
Medium Risk
Changes the evaluation data-loading lifecycle from route model hooks to controller-managed async tasks, which can affect when/if results refresh on initial render and query-param changes.
Overview
Refactors the
course-admin/code-example-evaluatorpage to simplify the route model and shift evaluation fetching into the controller. The route now only loadscourse,evaluator,allLanguages, and the parsed filter slugs, removing evaluation/trusted-evaluation types and the route’s filter/query helpers.The controller now owns
pass/fail/unsureevaluation lists as@trackedstate and adds aloadEvaluationsTaskthat queries the store (plus trusted evaluations) in parallel and exposes anisLoadingEvaluationsflag. The template switches to reading evaluations from controller state instead of@model.Written by Cursor Bugbot for commit 431f831. This will update automatically on new commits. Configure here.