Skip to content

Commit 25989df

Browse files
committed
Fixes signage issue in discrimination index on Quiz Stats
Indicates both positive and negative with respect to the threshold and now indicates + and - with respect to 0 (like numbers should) independently. Closes CNVS-18382 Test Plan: - Create student responses for a quiz to create a discrimination index of 0.25>x>0.0 and 0.0>x for two questions - See that discrimination index shows red and positive, and red and negative respectively, rather than being red and negative and red and negative as was reported. Change-Id: Iebd1eae671d2c7738069728714e934aea10aa717 Reviewed-on: https://gerrit.instructure.com/49384 Tested-by: Jenkins Reviewed-by: Cameron Sutter <csutter@instructure.com> QA-Review: Amber Taniuchi <amber@instructure.com> Product-Review: Ryan Taylor <rtaylor@instructure.com>
1 parent fda594b commit 25989df

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

client_apps/canvas_quizzes/apps/statistics/js/views/charts/discrimination_index.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ define(function(require) {
3636

3737
render: function() {
3838
var di = this.props.discriminationIndex;
39-
var sign = di > K.DISCRIMINATION_INDEX_THRESHOLD ? '+' : '-';
39+
var passing = di > K.DISCRIMINATION_INDEX_THRESHOLD ? '+' : '-';
40+
var sign = di > 0 ? '+' : '-';
4041
var className = {
4142
'index': true,
42-
'positive': sign === '+',
43-
'negative': sign !== '+'
43+
'positive': passing === '+',
44+
'negative': passing !== '+'
4445
};
4546

4647
// TODO: it would be nice if we move this to the model layer so we don't

client_apps/canvas_quizzes/apps/statistics/test/unit/views/charts/discrimination_index_test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,19 @@ define(function(require) {
3535
expect(find('.index').className).toMatch('negative');
3636
});
3737

38-
it('shows a "-" sign when positive', function() {
38+
it('shows a "+" sign when below the threshold and above 0', function() {
3939
setProps({
4040
discriminationIndex: K.DISCRIMINATION_INDEX_THRESHOLD - 0.1
4141
});
4242

43+
expect(find('.sign').innerText).toEqual('+');
44+
});
45+
46+
it('shows a "-" sign when below 0', function(){
47+
setProps({
48+
discriminationIndex: -0.1
49+
});
50+
4351
expect(find('.sign').innerText).toEqual('-');
4452
});
4553

0 commit comments

Comments
 (0)