Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ddb2483
Update the XBlock version.
Dec 2, 2013
7171397
extend max_length of anonymous_user_id (LMS-1571)
adampalay Dec 4, 2013
838622f
Handle integrity errors when creating/retrieving AnonymousUserId entries
cpennington Dec 4, 2013
eb23b65
add temporary error message for ORA panel
adampalay Dec 4, 2013
83c6a72
Merge pull request #1841 from edx/hotfix/error-msg-ORA-panel
nedbat Dec 4, 2013
175e1aa
adds more temporary error messages
adampalay Dec 4, 2013
19c6b85
Merge pull request #1842 from edx/hotfix/error-msg-ORA-panel
nedbat Dec 4, 2013
c7ac410
Merge pull request #1840 from edx/adam/db-error
nedbat Dec 4, 2013
e440381
Fix LTI max_score method.
polesye Dec 3, 2013
c4515fa
Make has_score to be XField insted of decriptor property.
auraz Dec 3, 2013
e961086
Fix LTI tests.
auraz Dec 3, 2013
4d50601
Add a backwards migration to delete the archive table
adampalay Dec 4, 2013
e561c13
Add managemant command to generate sql to clean up tp truncated stude…
cpennington Dec 4, 2013
b9926a2
Add message explaining partial recovery
cpennington Dec 4, 2013
3118a5d
Merge pull request #1852 from cpennington/more-db-error-fixes
nedbat Dec 4, 2013
326d9db
Merge pull request #1851 from edx/ned/merge-lti-hotfix
nedbat Dec 4, 2013
a458b46
modify partial recovery message
adampalay Dec 4, 2013
72bb0f8
Merge pull request #1854 from cpennington/wording-fixes
cpennington Dec 5, 2013
9d48bb0
removes temporary error messages
adampalay Dec 5, 2013
108e02e
Remove the one-time-use managemant command.
Dec 5, 2013
be3ab1c
Drop the temp table
Dec 5, 2013
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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

32 changes: 25 additions & 7 deletions common/djangoapps/student/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.signals import user_logged_in, user_logged_out
from django.db import models
from django.db import models, IntegrityError
from django.db.models.signals import post_save
from django.dispatch import receiver
import django.dispatch
Expand Down Expand Up @@ -53,7 +53,7 @@ class AnonymousUserId(models.Model):
http://docs.python.org/2/library/md5.html#md5.digest_size
"""
user = models.ForeignKey(User, db_index=True)
anonymous_user_id = models.CharField(unique=True, max_length=16)
anonymous_user_id = models.CharField(unique=True, max_length=32)
course_id = models.CharField(db_index=True, max_length=255)
unique_together = (user, course_id)

Expand All @@ -74,12 +74,30 @@ def anonymous_id_for_user(user, course_id):
hasher.update(settings.SECRET_KEY)
hasher.update(str(user.id))
hasher.update(course_id)
digest = hasher.hexdigest()

return AnonymousUserId.objects.get_or_create(
defaults={'anonymous_user_id': hasher.hexdigest()},
user=user,
course_id=course_id
)[0].anonymous_user_id
try:
anonymous_user_id, created = AnonymousUserId.objects.get_or_create(
defaults={'anonymous_user_id': digest},
user=user,
course_id=course_id
)
if anonymous_user_id.anonymous_user_id != digest:
log.error(
"Stored anonymous user id {stored!r} for user {user!r} "
"in course {course!r} doesn't match computed id {digest!r}".format(
user=user,
course=course_id,
stored=anonymous_user_id.anonymous_user_id,
digest=digest
)
)
except IntegrityError:
# Another thread has already created this entry, so
# continue
pass

return digest


def user_by_anonymous_id(id):
Expand Down
4 changes: 2 additions & 2 deletions common/lib/xmodule/xmodule/lti_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class LTIFields(object):
open_in_a_new_page = Boolean(help="Should LTI be opened in new page?", default=True, scope=Scope.settings)
graded = Boolean(help="Grades will be considered in overall score.", default=False, scope=Scope.settings)
weight = Float(help="Weight for student grades.", default=1.0, scope=Scope.settings)
has_score = Boolean(help="Does this LTI module have score?", default=False, scope=Scope.settings)


class LTIModule(LTIFields, XModule):
Expand Down Expand Up @@ -375,7 +376,7 @@ def oauth_params(self, custom_parameters, client_key, client_secret):
return params

def max_score(self):
return self.weight
return self.weight if self.has_score else None


@XBlock.handler
Expand Down Expand Up @@ -581,6 +582,5 @@ class LTIDescriptor(LTIFields, MetadataOnlyEditingDescriptor, EmptyDataRawDescri
"""
Descriptor for LTI Xmodule.
"""
has_score = True
module_class = LTIModule
grade_handler = module_attr('grade_handler')
14 changes: 14 additions & 0 deletions common/lib/xmodule/xmodule/tests/test_lti_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def test_good_request(self):
Response from Tool Provider is correct.
"""
self.xmodule.verify_oauth_body_sign = Mock()
self.xmodule.has_score = True
request = Request(self.environ)
request.body = self.get_request_body()
response = self.xmodule.grade_handler(request, '')
Expand Down Expand Up @@ -249,3 +250,16 @@ def test_verify_oauth_body_sign(self):
def test_client_key_secret(self):
pass

def test_max_score(self):
self.xmodule.weight = 100.0

self.xmodule.graded = True
self.assertEqual(self.xmodule.max_score(), None)

self.xmodule.has_score = True
self.assertEqual(self.xmodule.max_score(), 100.0)

self.xmodule.graded = False
self.assertEqual(self.xmodule.max_score(), 100.0)


4 changes: 2 additions & 2 deletions lms/djangoapps/courseware/features/lti.feature
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ Feature: LMS.LTI component
Scenario: Graded LTI component in LMS is correctly works
Given the course has correct LTI credentials
And the course has an LTI component with correct fields:
| open_in_a_new_page | weight | is_graded |
| False | 10 | True |
| open_in_a_new_page | weight | is_graded | has_score |
| False | 10 | True | True |
And I submit answer to LTI question
And I click on the "Progress" tab
Then I see text "Problem Scores: 5/10"
Expand Down
3 changes: 2 additions & 1 deletion lms/templates/instructor/staff_grading.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
<h1>${_("Staff grading")}</h1>
<div class="breadcrumbs"></div>
<div class="error-container"></div>

<div class="message-container"></div>

<! -- Problem List View -->
<!-- Problem List View -->
<section class="problem-list-container">
<h2>${_("Instructions")}</h2>
<div class="instructions">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<section class="container">
<div class="combined-notifications" data-ajax_url="${ajax_url}">
<div class="error-container">${error_text}</div>

<h1>${_("Open Ended Console")}</h1>
<h2>${_("Instructions")}</h2>
<p>${_("Here are items that could potentially need your attention.")}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<section class="container">
<div class="open-ended-problems" data-ajax_url="${ajax_url}">
<div class="error-container">${error_text}</div>

<h1>${_("Flagged Open Ended Problems")}</h1>
<h2>${_("Instructions")}</h2>
<p>${_("Here are a list of open ended problems for this course that have been flagged by students as potentially inappropriate.")}</p>
Expand Down
2 changes: 1 addition & 1 deletion lms/templates/open_ended_problems/open_ended_problems.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ <h2>${_("Instructions")}</h2>
%endif
%endif
</div>
</section>
</section>
2 changes: 1 addition & 1 deletion requirements/edx/github.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-e git+https://github.com/eventbrite/zendesk.git@d53fe0e81b623f084e91776bcf6369f8b7b63879#egg=zendesk

# Our libraries:
-e git+https://github.com/edx/XBlock.git@341d162f353289cfd3974a4f4f9354ce81ab60db#egg=XBlock
-e git+https://github.com/edx/XBlock.git@c54c63cf8294c54512887e6232d4274003afc6e3#egg=XBlock
-e git+https://github.com/edx/codejail.git@0a1b468#egg=codejail
-e git+https://github.com/edx/diff-cover.git@v0.2.6#egg=diff_cover
-e git+https://github.com/edx/js-test-tool.git@v0.1.4#egg=js_test_tool
Expand Down