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/0.12.0 #17

Merged
merged 7 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
14 changes: 13 additions & 1 deletion RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
Release Notes
=============

Version 0.11.0
Version 0.12.0 (Released October 07, 2020)
--------------

- Allow a grade of zero
- removed deprecated usage of xblock fragment (#270)
- Fix mismatch version (#272)

Version 0.11.1 (Released August 12, 2020)
--------------

- Fix mismatch version (#272)

Version 0.11.0 (Released May 19, 2020)
--------------

- Temporarily disable integration and Python 2 tests (#267)
Expand Down
2 changes: 1 addition & 1 deletion edx_sga/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Module for StaffGradedAssignmentXBlock.
"""

__version__ = '0.11.0.appsembler2'
__version__ = '0.12.0.appsembler2'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be 0.12.0.appsembler1

1 change: 0 additions & 1 deletion edx_sga/management/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# pylint: disable=missing-docstring
7 changes: 3 additions & 4 deletions edx_sga/sga.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from xblock.core import XBlock
from xblock.exceptions import JsonHandlerError
from xblock.fields import DateTime, Float, Integer, Scope, String
from xblock.fragment import Fragment
from web_fragments.fragment import Fragment
from xblockutils.studio_editable import StudioEditableXBlockMixin
from xmodule.contentstore.content import StaticContent
from xmodule.util.duedate import get_extended_due_date
Expand Down Expand Up @@ -165,7 +165,7 @@ def file_size_over_limit(cls, file_obj):
return file_obj.tell() > cls.student_upload_max_size()

@classmethod
def parse_xml(cls, node, runtime, keys, id_generator):
def parse_xml(cls, node, runtime, keys, id_generator): # pylint: disable=arguments-differ
"""
Override default serialization to handle <solution /> elements
"""
Expand Down Expand Up @@ -239,7 +239,7 @@ def save_sga(self, data, suffix=''):

@XBlock.handler
def upload_assignment(self, request, suffix=''):
# pylint: disable=unused-argument, protected-access
# pylint: disable=unused-argument
"""
Save a students submission file.
"""
Expand Down Expand Up @@ -798,7 +798,6 @@ def staff_grading_data(self):
grading screen.
"""
def get_student_data():
# pylint: disable=no-member
"""
Returns a dict of student assignment information along with
annotated file name, student id and module id, this
Expand Down
2 changes: 1 addition & 1 deletion edx_sga/static/js/src/edx_sga.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function StaffGradedAssignmentXBlock(runtime, element) {
var max_score = row.parents('#grade-info').data('max_score');
var score = Number(form.find('#grade-input').val());
event.preventDefault();
if (!score) {
if (isNaN(score)) {
gradeFormError('<br/>'+gettext('Grade must be a number.'));
} else if (score !== parseInt(score)) {
gradeFormError('<br/>'+gettext('Grade must be an integer.'));
Expand Down
2 changes: 1 addition & 1 deletion edx_sga/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.core.files.storage import default_storage
from edx_sga.constants import ITEM_TYPE
from edx_sga.utils import get_file_storage_path
from lms import CELERY_APP # pylint: disable=no-name-in-module
from lms import CELERY_APP
from opaque_keys.edx.locator import BlockUsageLocator
from student.models import user_by_anonymous_id
from submissions import api as submissions_api
Expand Down
37 changes: 14 additions & 23 deletions edx_sga/tests/integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ def test_max_score_integer(self):
@mock.patch('edx_sga.sga.render_template')
@mock.patch('edx_sga.sga.Fragment')
def test_student_view(self, fragment, render_template):
# pylint: disable=unused-argument
"""
Test student view renders correctly.
"""
Expand All @@ -251,6 +250,7 @@ def test_student_view(self, fragment, render_template):
self.assertEqual(student_state['upload_allowed'], True)
self.assertEqual(student_state['max_score'], 100)
self.assertEqual(student_state['graded'], None)
# pylint: disable=no-member
fragment.add_css.assert_called_once_with(
DummyResource("static/css/edx_sga.css"))
fragment.initialize_js.assert_called_once_with(
Expand Down Expand Up @@ -292,7 +292,6 @@ def test_student_view_with_annotated(self, fragment, render_template):
@mock.patch('edx_sga.sga.render_template')
@mock.patch('edx_sga.sga.Fragment')
def test_student_view_with_score(self, fragment, render_template):
# pylint: disable=unused-argument
"""
Tests scores are displayed correctly on student view.
"""
Expand Down Expand Up @@ -320,13 +319,13 @@ def test_student_view_with_score(self, fragment, render_template):
self.assertEqual(student_state['max_score'], 100)
self.assertEqual(student_state['graded'],
{u'comment': '', u'score': 10})
# pylint: disable=no-member
fragment.add_css.assert_called_once_with(
DummyResource("static/css/edx_sga.css"))
fragment.initialize_js.assert_called_once_with(
"StaffGradedAssignmentXBlock")

def test_studio_view(self):
# pylint: disable=unused-argument
"""
Test studio view is using the StudioEditableXBlockMixin function
"""
Expand Down Expand Up @@ -407,9 +406,9 @@ def test_upload_download_assignment(self):

with mock.patch(
"edx_sga.sga.StaffGradedAssignmentXBlock.file_storage_path",
return_value=block.file_storage_path( # lint-amnesty, pylint: disable=protected-access
return_value=block.file_storage_path( # lint-amnesty
"", "test_notfound.txt"
) # lint-amnesty, pylint: disable=protected-access
) # lint-amnesty
):
response = block.download_assignment(None)
self.assertEqual(response.status_code, 404)
Expand All @@ -430,7 +429,6 @@ def test_finalize_uploaded_assignment(self):
self.assertTrue(recent_submission_data['answer']['finalized'])

def test_staff_upload_download_annotated(self):
# pylint: disable=no-member
"""
Tests upload and download of annotated staff files.
"""
Expand All @@ -446,9 +444,9 @@ def test_staff_upload_download_annotated(self):

with mock.patch(
"edx_sga.sga.StaffGradedAssignmentXBlock.file_storage_path",
return_value=block.file_storage_path( # lint-amnesty, pylint: disable=protected-access
return_value=block.file_storage_path( # lint-amnesty
"", "test_notfound.txt"
) # lint-amnesty, pylint: disable=protected-access
) # lint-amnesty
):
response = block.staff_download_annotated(
mock.Mock(
Expand All @@ -460,7 +458,6 @@ def test_staff_upload_download_annotated(self):
self.assertEqual(response.status_code, 404)

def test_staff_upload_annotated_state(self):
# pylint: disable=no-member
"""
Test state recorded in the module state when staff_upload_annotated is called
"""
Expand All @@ -486,7 +483,6 @@ def test_staff_upload_annotated_state(self):
assert state['annotated_sha1'] == get_sha1(expected)

def test_download_annotated(self):
# pylint: disable=no-member
"""
Test download annotated assignment for non staff.
"""
Expand All @@ -511,10 +507,10 @@ def test_download_annotated(self):

with mock.patch(
"edx_sga.sga.StaffGradedAssignmentXBlock.file_storage_path",
return_value=block.file_storage_path( # lint-amnesty, pylint: disable=protected-access
return_value=block.file_storage_path( # lint-amnesty
"",
"test_notfound.txt"
) # lint-amnesty, pylint: disable=protected-access
) # lint-amnesty
):
response = block.download_annotated(None)
self.assertEqual(response.status_code, 404)
Expand Down Expand Up @@ -546,10 +542,10 @@ def test_staff_download(self):
for student, __ in students:
with mock.patch(
"edx_sga.sga.StaffGradedAssignmentXBlock.file_storage_path",
return_value=block.file_storage_path( # lint-amnesty, pylint: disable=protected-access
return_value=block.file_storage_path( # lint-amnesty
"",
"test_notfound.txt"
) # lint-amnesty, pylint: disable=protected-access
) # lint-amnesty
):
response = block.staff_download(
mock.Mock(
Expand Down Expand Up @@ -577,10 +573,10 @@ def test_download_annotated_unicode_filename(self):

with mock.patch(
"edx_sga.sga.StaffGradedAssignmentXBlock.file_storage_path",
return_value=block.file_storage_path( # lint-amnesty, pylint: disable=protected-access
return_value=block.file_storage_path( # lint-amnesty
"",
"test_notfound.txt"
) # lint-amnesty, pylint: disable=protected-access
) # lint-amnesty
):
response = block.download_annotated(None)
self.assertEqual(response.status_code, 404)
Expand All @@ -600,10 +596,10 @@ def test_staff_download_unicode_filename(self):

with mock.patch(
"edx_sga.sga.StaffGradedAssignmentXBlock.file_storage_path",
return_value=block.file_storage_path( # lint-amnesty, pylint: disable=protected-access
return_value=block.file_storage_path( # lint-amnesty
"",
"test_notfound.txt"
) # lint-amnesty, pylint: disable=protected-access
) # lint-amnesty
):
response = block.staff_download(
mock.Mock(
Expand Down Expand Up @@ -654,7 +650,6 @@ def test_get_staff_grading_data_not_staff(self):
block.get_staff_grading_data(None)

def test_get_staff_grading_data(self):
# pylint: disable=no-member
"""
Test fetch grading data for staff members.
"""
Expand Down Expand Up @@ -725,7 +720,6 @@ def test_assert_logging_when_student_module_created(self, mocked_log):
self.assertIn(block.location, module_creation_log_message)

def test_enter_grade_instructor(self):
# pylint: disable=no-member
"""
Test enter grade by instructors.
"""
Expand All @@ -743,7 +737,6 @@ def test_enter_grade_instructor(self):
self.assertEqual(block.get_score(fred['item'].student_id), 9)

def test_enter_grade_staff(self):
# pylint: disable=no-member
"""
Test grade enter by staff.
"""
Expand All @@ -761,7 +754,6 @@ def test_enter_grade_staff(self):

@data(None, "", '9.24', "second")
def test_enter_grade_fail(self, grade):
# pylint: disable=no-member
"""
Tests grade enter fail.
"""
Expand All @@ -785,7 +777,6 @@ def test_enter_grade_fail(self, grade):
)

def test_remove_grade(self):
# pylint: disable=no-member
"""
Test remove grade.
"""
Expand Down
9 changes: 3 additions & 6 deletions edx_sga/tests/test_sga.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import six.moves.builtins as builtins # pylint: disable=ungrouped-imports
except ImportError:
# Python 3
import builtins # pylint: disable=ungrouped-imports
import builtins


SHA1 = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
Expand Down Expand Up @@ -206,7 +206,6 @@ def personalize_upload(self, block, upload):
@mock.patch('edx_sga.sga.render_template')
@mock.patch('edx_sga.sga.Fragment')
def test_student_view(self, fragment, render_template):
# pylint: disable=unused-argument
"""
Test student view renders correctly.
"""
Expand Down Expand Up @@ -238,6 +237,7 @@ def test_student_view(self, fragment, render_template):
assert student_state['upload_allowed'] is True
assert student_state['max_score'] == 100
assert student_state['graded'] is None
# pylint: disable=no-member
fragment.add_css.assert_called_once_with(
DummyResource("static/css/edx_sga.css"))
fragment.initialize_js.assert_called_once_with(
Expand All @@ -249,7 +249,6 @@ def test_student_view(self, fragment, render_template):
@mock.patch('edx_sga.sga.render_template')
@mock.patch('edx_sga.sga.Fragment')
def test_student_view_with_score(self, fragment, render_template, get_score, upload_allowed):
# pylint: disable=unused-argument
"""
Tests scores are displayed correctly on student view.
"""
Expand Down Expand Up @@ -292,7 +291,7 @@ def test_student_view_with_score(self, fragment, render_template, get_score, upl
assert student_state['uploaded'] == {'filename': 'foo.txt'}
assert student_state['graded'] == {'comment': 'ok', 'score': 10}
assert student_state['max_score'] == 100

# pylint: disable=no-member
fragment.add_css.assert_called_once_with(
DummyResource("static/css/edx_sga.css"))
fragment.initialize_js.assert_called_once_with(
Expand Down Expand Up @@ -459,7 +458,6 @@ def test_finalize_uploaded_assignment(
@mock.patch('edx_sga.sga.StaffGradedAssignmentXBlock.is_course_staff')
@mock.patch('edx_sga.sga.get_sha1')
def test_staff_upload_download_annotated(self, get_sha1, is_course_staff, get_student_module):
# pylint: disable=no-member
"""
Tests upload and download of annotated staff files.
"""
Expand Down Expand Up @@ -496,7 +494,6 @@ def test_staff_upload_download_annotated(self, get_sha1, is_course_staff, get_st
@mock.patch('edx_sga.sga.StaffGradedAssignmentXBlock.is_course_staff')
@mock.patch('edx_sga.sga.get_sha1')
def test_download_annotated(self, get_sha1, is_course_staff, get_student_module):
# pylint: disable=no-member
"""
Test download annotated assignment for non staff.
"""
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def package_data(pkg, root_list):
install_requires=[
'XBlock',
'xblock-utils',
'web_fragments',
],
entry_points={
'xblock.v1': [
Expand Down