Skip to content

Commit

Permalink
feat: block team ORAs from ESG (for now) (#1849)
Browse files Browse the repository at this point in the history
* feat: block team ORAs from ESG (for now)

* style: quality

* test: test

* chore: static

* chore: version
  • Loading branch information
jansenk committed Apr 19, 2022
1 parent 4b0a8c3 commit 8790ee8
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 24 deletions.
2 changes: 1 addition & 1 deletion openassessment/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
Initialization Information for Open Assessment Module
"""
__version__ = '4.1.3'
__version__ = '4.1.4'
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
<a href="{{enhanced_staff_grader_url}}" class="ui-staff__button button-enhanced-staff-grader" aria-expanded="false">{% trans "Enhanced Staff Grader" %} <span class="icon fa fa-external-link" aria-hidden="true"></span></a>
{% else %}
<button class="ui-staff__button button-staff-grading" aria-expanded="false" data-panel="openassessment__staff-grading">{% trans "Grade Available Responses" %}</button>
<a href="{{enhanced_staff_grader_url}}" class="ui-staff__button button-enhanced-staff-grader button-enhanced-staff-grader-demo" aria-expanded="false">{% trans "Demo the new Grading Experience" %} <span class="icon fa fa-external-link" aria-hidden="true"></span></a>
{% comment %} Remove if block in AU-617 {% endcomment %}
{% if not is_team_assignment %}
<a href="{{enhanced_staff_grader_url}}" class="ui-staff__button button-enhanced-staff-grader button-enhanced-staff-grader-demo" aria-expanded="false">{% trans "Demo the new Grading Experience" %} <span class="icon fa fa-external-link" aria-hidden="true"></span></a>
{% endif %}
{% endif %}
{% endif %}
<a href="{{studio_edit_url}}" class="ui-staff__button button-staff-studio" aria-expanded="false" data-panel="openassessment__staff-studio">{% trans "View ORA in Studio" %}</a>
Expand Down
6 changes: 5 additions & 1 deletion openassessment/xblock/staff_area_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ def get_staff_path_and_context(self):
staff_assessment_required = "staff-assessment" in self.assessment_steps
context['staff_assessment_required'] = staff_assessment_required
if staff_assessment_required:
context['is_enhanced_staff_grader_enabled'] = self.is_enhanced_staff_grader_enabled
# TODO: Remove in AU-617
if self.is_team_assignment():
context['is_enhanced_staff_grader_enabled'] = False
else:
context['is_enhanced_staff_grader_enabled'] = self.is_enhanced_staff_grader_enabled
context['enhanced_staff_grader_url'] = '{esg_url}/{block_id}'.format(
esg_url=getattr(settings, 'ORA_GRADING_MICROFRONTEND_URL', ''),
block_id=str(self.get_xblock_id())
Expand Down
4 changes: 2 additions & 2 deletions openassessment/xblock/static/dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"openassessment-editor-textarea.js.map": "/openassessment-editor-textarea.0babe8f5dfb2d462894a.js.map",
"openassessment-editor-tinymce.js": "/openassessment-editor-tinymce.990d808ee1930fbf3200.js",
"openassessment-editor-tinymce.js.map": "/openassessment-editor-tinymce.990d808ee1930fbf3200.js.map",
"openassessment-lms.js": "/openassessment-lms.7c5600436e4752c25e24.js",
"openassessment-lms.js.map": "/openassessment-lms.7c5600436e4752c25e24.js.map",
"openassessment-lms.js": "/openassessment-lms.c44eef838bb7133e8a53.js",
"openassessment-lms.js.map": "/openassessment-lms.c44eef838bb7133e8a53.js.map",
"openassessment-ltr.css": "/openassessment-ltr.cbb22addba015566f38b.css",
"openassessment-ltr.js": "/openassessment-ltr.cbb22addba015566f38b.js",
"openassessment-ltr.css.map": "/openassessment-ltr.cbb22addba015566f38b.css.map",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "33d97ad88f3bc808ea26";
/******/ var hotCurrentHash = "5cec704a65f0abf87ae4";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "33d97ad88f3bc808ea26";
/******/ var hotCurrentHash = "5cec704a65f0abf87ae4";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions openassessment/xblock/static/dist/openassessment-lms.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion openassessment/xblock/static/dist/openassessment-ltr.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "33d97ad88f3bc808ea26";
/******/ var hotCurrentHash = "5cec704a65f0abf87ae4";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down
2 changes: 1 addition & 1 deletion openassessment/xblock/static/dist/openassessment-rtl.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "33d97ad88f3bc808ea26";
/******/ var hotCurrentHash = "5cec704a65f0abf87ae4";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down
2 changes: 1 addition & 1 deletion openassessment/xblock/static/dist/openassessment-studio.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions openassessment/xblock/static/js/spec/lms/oa_listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,17 @@ describe("OpenAssessment.CourseItemsListingView", function() {
var staffItems = $('.open-response-assessment-main-table td.renderable.staff');

staffItems.each((_, item) => {
expect(item.classList).toContain('string-cell');
expect(item.classList).not.toContain('uri-cell');
expect(item.children.length).toEqual(0);
})
});

it('staff grader column should lead to ora-grading.', () => {
var esgItems = $('.staff-esg-link');
expect(esgItems.length).toEqual(testData.length);
expect(esgItems.length).toEqual(1);

esgItems.each((_, item) => {
expect(item.innerHTML).toEqual("View and grade responses")
expect(item.href).toContain(data.CONTEXT.ORA_GRADING_MICROFRONTEND_URL)
expect(item.innerHTML).toEqual("View and grade responses");
expect(item.href).toContain(data.CONTEXT.ORA_GRADING_MICROFRONTEND_URL);
});
});

Expand Down Expand Up @@ -375,7 +373,7 @@ describe("OpenAssessment.CourseItemsListingView", function() {

it('staff grader column should lead to demo of ora-grading', () => {
var esgItems = $('.staff-esg-link');
expect(esgItems.length).toEqual(testData.length);
expect(esgItems.length).toEqual(1);

esgItems.each((_, item) => {
expect(item.innerHTML).toEqual("Demo the new Grading Experience")
Expand Down
21 changes: 17 additions & 4 deletions openassessment/xblock/static/js/src/lms/oa_course_items_listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export class CourseItemsListingView {
const AssessmentCell = Backgrid.UriCell.extend({
type: null,
url: null,
// Should be removed as a part of AU-617
shouldShowLink() {
return true;
},
render() {
this.$el.empty();
const name = this.column.get('name');
Expand All @@ -31,7 +35,7 @@ export class CourseItemsListingView {
const formattedValue = this.formatter.fromRaw(rawValue, this.model);
const hasAssessmentType = this.model.get(this.type ? this.type : 'staff_assessment');
let link = null;
if (itemViewEnabled && (!this.type || (this.type && hasAssessmentType))) {
if (itemViewEnabled && (!this.type || (this.type && hasAssessmentType)) && this.shouldShowLink()) {
link = $('<a>', {
text: formattedValue,
title: this.title || formattedValue,
Expand All @@ -57,13 +61,18 @@ export class CourseItemsListingView {
const displayValue = esgEnabled ? gettext('View and grade responses') : gettext('Demo the new Grading Experience');
const id = this.model.get('id');
const url = `${esgRootUrl}/${id}`;
const hasAssessmentType = this.model.get('staff_assessment');
const link = $('<a>', {
text: displayValue,
title: displayValue,
href: url,
class: 'staff-esg-link',
});
this.$el.append(link);
// Remove this in AU-617
const teamAssignment = this.model.get('team_assignment');
if (hasAssessmentType && !teamAssignment) {
this.$el.append(link);
}
return this;
},
});
Expand All @@ -74,8 +83,12 @@ export class CourseItemsListingView {
});

const StaffCell = AssessmentCell.extend({
type: 'staff_assessment',
url: 'url_grade_available_responses',
type: 'staff_assessment',
// Should be removed as a part of AU-617
shouldShowLink() {
return this.model.get('team_assignment') || !esgEnabled;
},
});

this._columns = [
Expand Down Expand Up @@ -139,7 +152,7 @@ export class CourseItemsListingView {
name: 'staff',
label: gettext('Staff'),
label_summary: gettext('Staff'),
cell: esgEnabled ? 'string' : StaffCell,
cell: StaffCell,
num: true,
editable: false,
},
Expand Down

0 comments on commit 8790ee8

Please sign in to comment.