Commit 6db440fc by Eric Fischer

Open Responses Dashboard fixes

Fix issue with 'staff' and 'waiting' numbers being incorrect due to odd
translation. Fix CSS issue with overflow in cells for large numbers.

EDUCATOR-118, EDUCATOR-156
parent c4216747
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
%> %>
<td class="string-cell renderable <%- s.class %>"> <td class="string-cell renderable <%- s.class %>">
<div class="ora-summary-title"><%- s.title %></div> <div class="ora-summary-title"><%- s.title %></div>
<div class="ora-summary-value"><%- s.value %></div> <div class="ora-summary-value" title="<%- s.value %>"><%- s.value %></div>
</td> </td>
<% } %> <% } %>
</tr> </tr>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -49,7 +49,7 @@ describe("OpenAssessment.CourseItemsListingView", function() { ...@@ -49,7 +49,7 @@ describe("OpenAssessment.CourseItemsListingView", function() {
"training": 0, "training": 0,
"self": 0, "self": 0,
"peer": 1, "peer": 1,
"waiting": 0, "waiting": 1, // will remain 'waiting'
"ai": 0, "ai": 0,
"done": 0, "done": 0,
"cancelled": 0, "cancelled": 0,
...@@ -68,7 +68,7 @@ describe("OpenAssessment.CourseItemsListingView", function() { ...@@ -68,7 +68,7 @@ describe("OpenAssessment.CourseItemsListingView", function() {
"training": 3, "training": 3,
"self": 0, "self": 0,
"peer": 0, "peer": 0,
"waiting": 5, "waiting": 5, //will be translated to 'staff'
"ai": 0, "ai": 0,
"done": 0, "done": 0,
"cancelled": 0, "cancelled": 0,
...@@ -144,12 +144,12 @@ describe("OpenAssessment.CourseItemsListingView", function() { ...@@ -144,12 +144,12 @@ describe("OpenAssessment.CourseItemsListingView", function() {
expect(section.find('.open-response-assessment-msg').is(':visible')).toBe(false); expect(section.find('.open-response-assessment-msg').is(':visible')).toBe(false);
expect(section.find('.open-response-assessment-content').is(':visible')).toBe(true); expect(section.find('.open-response-assessment-content').is(':visible')).toBe(true);
var expectedArr = [3, 3, 12, 3, 2, 0, 5, 2]; var expectedArr = [3, 3, 13, 3, 2, 0, 1, 5, 2];
var summaryRowValuesArr = []; var summaryRowValuesArr = [];
section.find('.open-response-assessment-summary td div.ora-summary-value').each(function(i, val) { section.find('.open-response-assessment-summary td div.ora-summary-value').each(function(i, val) {
summaryRowValuesArr.push(parseInt($(val).text())); summaryRowValuesArr.push(parseInt($(val).text()));
}); });
expect(_.isEqual(summaryRowValuesArr, expectedArr)).toBe(true); expect(summaryRowValuesArr).toEqual(expectedArr);
var rows = $('.open-response-assessment-main-table tbody tr'); var rows = $('.open-response-assessment-main-table tbody tr');
expect(rows.length).toBe(3); expect(rows.length).toBe(3);
...@@ -166,13 +166,13 @@ describe("OpenAssessment.CourseItemsListingView", function() { ...@@ -166,13 +166,13 @@ describe("OpenAssessment.CourseItemsListingView", function() {
var expectedTds = [ var expectedTds = [
["Vertical 1", '<a title="Test ORA 1">Test ORA 1</a>', ["Vertical 1", '<a title="Test ORA 1">Test ORA 1</a>',
'1', '0', '1', '0', '0', '0'], '2', '0', '1', '0', '1', '0', '0'],
["Vertical 2", '<a title="Test ORA 2">Test ORA 2</a>', ["Vertical 2", '<a title="Test ORA 2">Test ORA 2</a>',
'8', '3', '0', '0', '<a title="5">5</a>', '0'], '8', '3', '0', '0', '0', '<a title="5">5</a>', '0'],
["Vertical 3", '<a title="Test ORA 3">Test ORA 3</a>', ["Vertical 3", '<a title="Test ORA 3">Test ORA 3</a>',
'3', '0', '1', '0', '0', '2'] '3', '0', '1', '0', '0', '0', '2']
]; ];
expect(_.isEqual(tds, expectedTds)).toBe(true); expect(tds).toEqual(expectedTds);
}); });
it('shows error on failure callback', function() { it('shows error on failure callback', function() {
......
...@@ -69,7 +69,11 @@ ...@@ -69,7 +69,11 @@
cell: "string", num: true, editable: false cell: "string", num: true, editable: false
}, },
{ {
name: 'waiting', label: gettext("Staff"), label_summary: gettext("Staff"), name: 'waiting', label: gettext("Waiting"), label_summary: gettext("Waiting"),
cell: "string", num: true, editable: false
},
{
name: 'staff', label: gettext("Staff"), label_summary: gettext("Staff"),
cell: StaffCell, num: true, editable: false cell: StaffCell, num: true, editable: false
}, },
{ {
...@@ -116,25 +120,29 @@ ...@@ -116,25 +120,29 @@
var self = this; var self = this;
var $section = this.$section; var $section = this.$section;
var block = $section.find('.open-response-assessment-block'); var block = $section.find('.open-response-assessment-block');
var oraSteps = ['training', 'peer', 'self', 'waiting', 'done']; var oraSteps = ['training', 'peer', 'self', 'waiting', 'staff', 'done'];
$.each(self.oraData, function(i, oraItem) { $.each(self.oraData, function(i, oraItem) {
var total = 0; var total = 0;
var itemId = oraItem.id; var itemId = oraItem.id;
$.each(oraSteps, function(j, step) { $.each(oraSteps, function(j, step) {
self.oraData[i][step] = 0; oraItem[step] = 0;
}); });
if (itemId in data) { if (itemId in data) {
_.extend(self.oraData[i], data[itemId]); _.extend(oraItem, data[itemId]);
if (oraItem.staff_assessment) {
oraItem.staff = oraItem.waiting;
oraItem.waiting = 0;
}
} }
$.each(oraSteps, function(j, step) { $.each(oraSteps, function(j, step) {
total += self.oraData[i][step]; total += oraItem[step];
}); });
self.oraData[i].total = total; oraItem.total = total;
}); });
block.data('rendered', 1); block.data('rendered', 1);
...@@ -151,27 +159,21 @@ ...@@ -151,27 +159,21 @@
$section.find(".open-response-assessment-summary").empty(); $section.find(".open-response-assessment-summary").empty();
$.each(this._columns, function(index, v) { $.each(this._columns, function(index, v) {
var realName = v.name === 'waiting' ? 'staff' : v.name;
summaryData.push({ summaryData.push({
title: v.label_summary, title: v.label_summary,
value: 0, value: 0,
num: v.num, num: v.num,
class: realName class: v.name
}); });
summaryDataMap[realName] = index; summaryDataMap[v.name] = index;
}); });
$.each(data, function(index, obj) { $.each(data, function(index, obj) {
var staffGradeRequired = obj.staff_assessment;
$.each(obj, function(key, value) { $.each(obj, function(key, value) {
var idx = 0; var idx = 0;
var realKey = key; if (key in summaryDataMap) {
if (key === 'waiting' && staffGradeRequired) { idx = summaryDataMap[key];
realKey = 'staff';
}
if (realKey in summaryDataMap) {
idx = summaryDataMap[realKey];
if (summaryData[idx].num) { if (summaryData[idx].num) {
summaryData[idx].value += value; summaryData[idx].value += value;
} else { } else {
......
...@@ -56,6 +56,11 @@ ...@@ -56,6 +56,11 @@
} }
} }
%truncated-digits {
text-overflow: ellipsis;
overflow: hidden;
}
.ora-summary-title { .ora-summary-title {
color: #0079bc; color: #0079bc;
font-weight: bold; font-weight: bold;
...@@ -64,22 +69,21 @@ ...@@ -64,22 +69,21 @@
} }
.ora-summary-value { .ora-summary-value {
font-size: 2.2em; @extend %truncated-digits;
font-size: 1.5em;
padding-top: 3px; padding-top: 3px;
} }
.backgrid { .backgrid {
.peer, .self, .staff, .waiting { @extend %truncated-digits;
width: 65px; .peer, .self, .staff, .waiting, .training {
} width: 80px;
.training {
width: 90px;
} }
.total { .total {
width: 150px; width: 130px;
} }
.done { .done {
width: 190px; width: 160px;
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment