From f2d20331b8e6095e3a7f5e10b7298ac85281b57b Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Sun, 21 Aug 2022 15:47:06 -0400 Subject: [PATCH 1/8] test: add failing test cases for overrides+missed --- cypress/fixtures/cbl/calculations.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cypress/fixtures/cbl/calculations.json b/cypress/fixtures/cbl/calculations.json index 985edd4f9..a6dc53d95 100644 --- a/cypress/fixtures/cbl/calculations.json +++ b/cypress/fixtures/cbl/calculations.json @@ -66,6 +66,14 @@ "progress": "88", "progressMissed": "0" }, + "HW.2": { + "description": "Overrides with Ms only", + "baseline": null, + "average": null, + "growth": null, + "progress": "40", + "progressMissed": "30" + }, "HW.3": { "description": "Overrides only", "baseline": null, @@ -75,6 +83,14 @@ } }, "HOS": { + "HOS.2": { + "description": "Ratings and Ms for every evidence requirement in a skill with an override.", + "baseline": null, + "average": "7", + "growth": "1", + "progress": "83", + "progressMissed": "999" + }, "HOS.3": { "description": "All M’s only with one ER for each skill", "baseline": null, From cc41fe67944192d3026a724403d44f11da064c2d Mon Sep 17 00:00:00 2001 From: BillClinton Date: Wed, 14 Dec 2022 17:46:20 -0500 Subject: [PATCH 2/8] fix: Replace 999 with correct progressMissed --- cypress/fixtures/cbl/calculations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/fixtures/cbl/calculations.json b/cypress/fixtures/cbl/calculations.json index a6dc53d95..8a72a8186 100644 --- a/cypress/fixtures/cbl/calculations.json +++ b/cypress/fixtures/cbl/calculations.json @@ -89,7 +89,7 @@ "average": "7", "growth": "1", "progress": "83", - "progressMissed": "999" + "progressMissed": "17" }, "HOS.3": { "description": "All M’s only with one ER for each skill", From ad1d69ff54fcbb5d7213101c5bc669add511a082 Mon Sep 17 00:00:00 2001 From: BillClinton Date: Thu, 15 Dec 2022 18:02:18 -0500 Subject: [PATCH 3/8] fix: bump M ratings when override exists --- php-classes/Slate/CBL/StudentCompetency.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/php-classes/Slate/CBL/StudentCompetency.php b/php-classes/Slate/CBL/StudentCompetency.php index e133cd0a8..43f9f3686 100644 --- a/php-classes/Slate/CBL/StudentCompetency.php +++ b/php-classes/Slate/CBL/StudentCompetency.php @@ -329,9 +329,29 @@ public function getEffectiveDemonstrationsData() $demonstrationsData = $this->getDemonstrationsData(); foreach ($demonstrationsData as $skillId => &$demonstrationData) { + // Check if there are overrides + $overrideExists = false; + foreach ($demonstrationData as $item) { + if ($item['Override'] === true) { + $overrideExists = true; + break; + } + } + + // If any overrides exist, bump all M ratings + if ($overrideExists) { + $filteredDemonstrationData = array_filter($demonstrationData, function($datum) { + if ($datum['DemonstratedLevel'] !== 0) { + return true; + } + }); + $demonstrationData = $filteredDemonstrationData; + } + usort($demonstrationData, [__CLASS__, 'sortEffectiveDemonstrations']); $Skill = Skill::getByID($skillId); + $demonstrationsRequired = $Skill->getDemonstrationsRequiredByLevel($this->Level); array_splice($demonstrationData, $demonstrationsRequired); From f5496d409e075b614e6b103ce9ca59dfc6b504eb Mon Sep 17 00:00:00 2001 From: BillClinton Date: Thu, 15 Dec 2022 18:02:42 -0500 Subject: [PATCH 4/8] fix: update test data to reflect code fix The test in question looks at #student/HW.3 and expected to see the Progress Missed bar at 25% because it has M ratings for 2 skills. But those two skills also have overrides, and now that the API is correctly bumping M Ratings when overrides exist, the Progress Missed bar should show 0%. --- cypress/fixtures/cbl/calculations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/fixtures/cbl/calculations.json b/cypress/fixtures/cbl/calculations.json index 8a72a8186..aa4e35750 100644 --- a/cypress/fixtures/cbl/calculations.json +++ b/cypress/fixtures/cbl/calculations.json @@ -36,7 +36,7 @@ "average": "7", "growth": "0", "progress": "75", - "progressMissed": "25" + "progressMissed": "0" } } }, From ff53740ea3e0a47925d355bca833b91e6176494b Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Fri, 16 Dec 2022 14:47:22 -0500 Subject: [PATCH 5/8] refactor: consolidate code Having no return value in the false case put me on edge --- php-classes/Slate/CBL/StudentCompetency.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/php-classes/Slate/CBL/StudentCompetency.php b/php-classes/Slate/CBL/StudentCompetency.php index 43f9f3686..c444ed7ed 100644 --- a/php-classes/Slate/CBL/StudentCompetency.php +++ b/php-classes/Slate/CBL/StudentCompetency.php @@ -340,12 +340,9 @@ public function getEffectiveDemonstrationsData() // If any overrides exist, bump all M ratings if ($overrideExists) { - $filteredDemonstrationData = array_filter($demonstrationData, function($datum) { - if ($datum['DemonstratedLevel'] !== 0) { - return true; - } + $demonstrationData = array_filter($demonstrationData, function($datum) { + return $datum['DemonstratedLevel'] !== 0; }); - $demonstrationData = $filteredDemonstrationData; } usort($demonstrationData, [__CLASS__, 'sortEffectiveDemonstrations']); From bf9574e233a5673e03f973471dc07feb94c517d0 Mon Sep 17 00:00:00 2001 From: BillClinton Date: Thu, 8 Dec 2022 13:39:07 -0500 Subject: [PATCH 6/8] fix: correct text clearing issue in task selector the task selector used in the clone task and subtask fields of the task form allow the user to type a string to filter results. Currently, when the user types a text string and results are returned, the query text dissappears. This creates confusion and does not allow the user to continue typing to make their query string more precise. This issues exists because the Task store does some post processing to decorate results with subtask arrays and parent task references. These references are not necessary when populating the task selector, so I altered the task selector to use the Task model rather than the task store, bypassing this post-processing. For specificity, the problem is caused by one specific line in the task store: `task.set('SubTasks', subTasks, { dirty: false });` the issue could also have been addressed by adding the silent flag to this setter like this: `task.set('SubTasks', subTasks, { dirty: false, silent: true });` But the ExtJS docs caution against the use of this flag, it could theoretically affect other parts of the app, and it seemed unnecessary in order to address this specific issue. --- sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js b/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js index 637989ad2..ec26017c3 100644 --- a/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js +++ b/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js @@ -2,7 +2,7 @@ Ext.define('Slate.cbl.field.TaskSelector', { extend: 'Slate.cbl.field.ClearableSelector', xtype: 'slate-cbl-taskselector', requires: [ - 'Slate.cbl.store.tasks.Tasks' + 'Slate.cbl.model.tasks.Task' ], @@ -20,7 +20,7 @@ Ext.define('Slate.cbl.field.TaskSelector', { store: { - type: 'slate-cbl-tasks', + model: 'Slate.cbl.model.tasks.Task', proxy: { type: 'slate-cbl-tasks', summary: true, From c6363fdab0908d9a74953876945c32bfc7d823ce Mon Sep 17 00:00:00 2001 From: BillClinton Date: Thu, 8 Dec 2022 16:50:35 -0500 Subject: [PATCH 7/8] fix: added pageSize config to return all results --- sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js b/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js index ec26017c3..134433a57 100644 --- a/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js +++ b/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js @@ -18,7 +18,6 @@ Ext.define('Slate.cbl.field.TaskSelector', { selectOnTab: false }, - store: { model: 'Slate.cbl.model.tasks.Task', proxy: { @@ -27,6 +26,7 @@ Ext.define('Slate.cbl.field.TaskSelector', { include: ['Creator'] }, remoteSort: true, + pageSize: 0, sorters: [{ property: 'Created', direction: 'DESC' From 8f87b66a832877d1e958d431b2176931a79e33f6 Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Fri, 9 Dec 2022 14:51:47 -0500 Subject: [PATCH 8/8] fix: set tasks search page size to 30 --- sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js b/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js index 134433a57..01e407a72 100644 --- a/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js +++ b/sencha-workspace/packages/slate-cbl/src/field/TaskSelector.js @@ -26,7 +26,7 @@ Ext.define('Slate.cbl.field.TaskSelector', { include: ['Creator'] }, remoteSort: true, - pageSize: 0, + pageSize: 30, sorters: [{ property: 'Created', direction: 'DESC'