Repository navigation
Exercise: Keep the status filter of the results list when coming back to it - #9280
Merged
ywarnier merged 1 commit intoOct 20, 2026
Conversation
… to it - Fixes chamilo#1643 On the legacy test results page (exercise_report.php), the Status filter of the grid toolbar (e.g. "Not validated") was reset to "All" every time the page was loaded, so after opening an attempt to correct it the teacher had to set it again. Remember the selected status per test in a cookie and restore it before the first grid request.
ybtbeez
force-pushed
the
fix/issue-1643-exercise-report-keep-status-filter
branch
from
October 20, 2026 10:32
0d5f49a to
f3ed15f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9280 +/- ##
=========================================
Coverage 17.20% 17.20%
Complexity 62176 62176
=========================================
Files 2522 2522
Lines 233319 233319
=========================================
Hits 40150 40150
Misses 193169 193169 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exercise: Keep the status filter of the results list when coming back to it
Fixes #1643
Problem
A teacher can open a test's results page (
main/exercise/exercise_report.php) and set the Statuscolumn filter to "Not validated" to see only the attempts still to correct. After opening an attempt to
correct it and coming back to the list, the filter is back to "All". The teacher has to set it again
for every attempt (#1643).
In 3.x, the main entry point (Tests list → Results) is the Vue report
(
/resources/exercise/<node>/<id>/report). It already keeps its filters in the URL query, so theysurvive going back.
The legacy page is still reachable and still lost the status filter. It is linked from:
admin.php);overview.php;exercise_show.php, whose correction form posts back toexercise_report.php;pending.php,stats.php,live_stats.php,question_stats.php,exercise_history.php;my_space/myStudents.php,reports.lib.php;Cause
exercise_report.phpbuilds the jqGrid filter toolbar on every page load. It tries to remember thegroup filter in a cookie (
default_group_<exerciseId>), but nothing remembers the status filter(
#gs_results_status). Each load starts again from the default, "All".Fix
One block in the page's inline script, in
public/main/exercise/exercise_report.php, right after thefilter toolbar is built and before the first
triggerToolbar():exercise_report_status_<exerciseId>.This follows the same pattern as the existing group-filter code. The select is addressed by its real
id,
gs_results_status: free-jqGrid's filter toolbar usesidMode: "new", which names the fieldsgs_<grid id>_<column>. The first grid request already asks the server for the filtered list, sothere is no extra request.
How it was tested
The branch is rebased on master 26b01e9. All runs below are from Oct 20, against a local portal
(APP_ENV=prod), with
npx playwright test --config=tests/playwright/playwright.config.ts <spec> --retries=0 --workers=1.tests/playwright/features/exerciseReportFilter.feature, with itsgenerated spec and one new step in
common.steps.ts: "I go to the legacy results page of the currenttest". The Vue pages no longer link to the legacy page, so the step reads the test id and
cid/sidfrom the current Vue URL.
EXRPTFand a test, then opens the legacy results page andchooses "Not validated".
filter still says "Not validated" (
gs_results_status=0).expect(locator).toHaveValue("0"), received""), 2 passed.toolExerciseAdmin.feature22/22 passed andtoolExerciseTeacher.feature26/26 passed. With the new feature: 51/51.php -l: OK.vendor/bin/ecs check public/main/exercise/exercise_report.php: one auto-fixable finding, the sameas on master, not in the changed block.
vendor/bin/phpstan analyse: 18 findings, identical to master, none in the changed block.on master.
Security review
$exercise_id.cookie cannot inject anything.
model.ajax.php.Notes for reviewers
milestone 3.1. ywarnier wrote in the issue: "have a first look then maybe ask questions to finetune
this quick report". This PR is that first look.
#gs_group_name. With free-jqGrid'sidMode: "new"that id does not exist (the real one isgs_results_group_name), so on 3.x the group filter is not remembered either.beforeRequest/group_id_in_toolbarlogic, which has not been running and needs its own testing.
page. If
exercise_report.phpis going to be retired soon, this PR can be dropped.session (the js-cookie default). The teacher clears the filter by choosing "All" again.
common.steps.ts. Whichever ismerged second needs a trivial rebase.