Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ratings): replace slider UI with new rater component [SCHOOL-17] #564

Draft
wants to merge 17 commits into
base: feat/ratings-backend
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/customization/cbl/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: CBL
33 changes: 33 additions & 0 deletions docs/customization/cbl/ratings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Ratings

## Options

### `minRating`

- Default: `5`
- The lowest rating presented on the primary scale

### `maxRating`

- Default: `12`
- The highest rating presented on the primary scale

### `menuRatings`

- Default: `[4, 3, 2, 1]`
- The ratings available on the secondary scale available under the menu button

### `enableMissing`

- Default: `true`
- Whether the `M` value is available on the primary scale

### `enableDidNotMeet`

- Default: `true`
- Whether the `DNM` value is available on the primary scale

### `enableCheckmark`

- Default: `true`
- Whether the checkmark value is available on the primary scale
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Slate\CBL\Demonstrations;


class DidNotMeetDemonstrationSkill extends DemonstrationSkill
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Slate\CBL\Demonstrations;


class MissingDemonstrationSkill extends DemonstrationSkill
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Slate\CBL\Demonstrations;


$tableName = DemonstrationSkill::$tableName;
$historyTableName = DemonstrationSkill::getHistoryTableName();

// skip if table doesn't exist
if (!static::tableExists($tableName)) {
printf("Skipping migration because table `%s` does not yet exist\n", $tableName);
return static::STATUS_SKIPPED;
}

// skip if Class column already contains DidNotMeet subclass
if (static::hasColumnEnumValue($tableName, 'Class', DidNotMeetDemonstrationSkill::class)) {
printf("Skipping migration because column `%s`.`Class` already has value '%s'\n", $tableName, DidNotMeetDemonstrationSkill::class);
return static::STATUS_SKIPPED;
}

// add new Class value
static::addColumnEnumValue($tableName, 'Class', DidNotMeetDemonstrationSkill::class);
static::addColumnEnumValue($historyTableName, 'Class', DidNotMeetDemonstrationSkill::class);
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Slate\CBL\Demonstrations;

use DB;


$tableName = DemonstrationSkill::$tableName;
$historyTableName = DemonstrationSkill::getHistoryTableName();

// skip if table doesn't exist
if (!static::tableExists($tableName)) {
printf("Skipping migration because table `%s` does not yet exist\n", $tableName);
return static::STATUS_SKIPPED;
}

// skip if Class column already contains Missing subclass
if (static::hasColumnEnumValue($tableName, 'Class', MissingDemonstrationSkill::class)) {
printf("Skipping migration because column `%s`.`Class` already has value '%s'\n", $tableName, MissingDemonstrationSkill::class);
return static::STATUS_SKIPPED;
}

// add new Class value
static::addColumnEnumValue($tableName, 'Class', MissingDemonstrationSkill::class);
static::addColumnEnumValue($historyTableName, 'Class', MissingDemonstrationSkill::class);

// migrate legacy missing demonstrations
DB::nonQuery(
'UPDATE `%s` SET Class = "%s", DemonstratedLevel = NULL WHERE Class = "%s" AND DemonstratedLevel = 0',
[
$tableName,
DB::escape(MissingDemonstrationSkill::class),
DB::escape(DemonstrationSkill::class)
]
);
printf(
"Updated %u DemonstrationSkill records with Rating = 0 to MissingDemonstrationSkill class\n",
DB::affectedRows()
);
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Ext.define('SlateDemonstrationsTeacher.controller.Demonstrations', {
modal: true,
layout: 'fit',
minWidth: 300,
width: 600,
width: 960,
minHeight: 600,

mainView: {
Expand Down Expand Up @@ -316,7 +316,7 @@ Ext.define('SlateDemonstrationsTeacher.controller.Demonstrations', {


// fetch demonstration and show window
if (!demonstration || (typeof demonstration == 'object' && !demonstration.isModel)) {
if (!demonstration || typeof demonstration == 'object' && !demonstration.isModel) {
demonstration = DemonstrationModel.create(Ext.apply({
Class: 'Slate\\CBL\\Demonstrations\\ExperienceDemonstration',
Demonstrated: new Date()
Expand Down Expand Up @@ -350,4 +350,4 @@ Ext.define('SlateDemonstrationsTeacher.controller.Demonstrations', {
Ext.Logger.error('Invalid demonstration option');
}
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Ext.define('SlateTasksTeacher.controller.StudentTasks', {
modal: true,
layout: 'fit',
minWidth: 300,
width: 600,
width: 960,
minHeight: 200,

mainView: {
Expand Down Expand Up @@ -318,4 +318,4 @@ Ext.define('SlateTasksTeacher.controller.StudentTasks', {
}
});
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ext.define('Slate.cbl.field.ratings.AbstractSkillsField', {

return {
ID: demonstrationSkill.ID || null,
Class: demonstrationSkill.Class || 'Slate\\CBL\\Demonstrations\\DemonstrationSkill',
SkillID: demonstrationSkill.SkillID,
TargetLevel: demonstrationSkill.TargetLevel || null,
DemonstratedLevel: demonstrationSkill.DemonstratedLevel,
Expand Down
Loading