Foldit integration.

- ops view for the desktop app to talk to
  - xmodule that talks to the foldit model and displays the student's state
  - grading tweak to make grade updates from an external service work:
    - Add an always_recalculate_grades property to XModuleDescriptor.
This commit is contained in:
Victor Shnayder
2013-02-05 11:09:21 -05:00
committed by Victor Shnayder
parent fffbb55944
commit 5e44846596
12 changed files with 690 additions and 3 deletions

View File

@@ -339,6 +339,14 @@ def get_score(course_id, user, problem_descriptor, module_creator, student_modul
Can return None if user doesn't have access, or if something else went wrong.
cache: A StudentModuleCache
"""
if problem_descriptor.always_recalculate_grades:
problem = module_creator(problem_descriptor)
d = problem.get_score()
if d is not None:
return (d['score'], d['total'])
else:
return (None, None)
if not (problem_descriptor.stores_state and problem_descriptor.has_score):
# These are not problems, and do not have a score
return (None, None)

View File

@@ -590,6 +590,9 @@ INSTALLED_APPS = (
'wiki.plugins.notifications',
'course_wiki.plugins.markdownedx',
# foldit integration
'foldit',
# For testing
'django.contrib.admin', # only used in DEBUG mode

View File

@@ -248,3 +248,17 @@ section.self-assessment {
font-weight: bold;
}
}
section.foldit {
table {
margin-top: 10px;
}
th {
text-align: center;
}
td {
padding-left: 5px;
padding-right: 5px;
}
}

28
lms/templates/foldit.html Normal file
View File

@@ -0,0 +1,28 @@
<section class="foldit">
<p><strong>Due:</strong> ${due}
<p>
<strong>Status:</strong>
% if success:
You have successfully gotten to level ${goal_level}.
% else:
You have not yet gotten to level ${goal_level}.
% endif
</p>
<h3>Completed puzzles</h3>
<table>
<tr>
<th>Level</th>
<th>Submitted</th>
</tr>
% for puzzle in completed:
<tr>
<td>${'{0}-{1}'.format(puzzle['set'], puzzle['subset'])}</td>
<td>${puzzle['created'].strftime('%Y-%m-%d %H:%M')}</td>
</tr>
% endfor
</table>
</section>

View File

@@ -288,7 +288,7 @@ if settings.COURSEWARE_ENABLED:
# Open Ended problem list
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_problems$',
'open_ended_grading.views.student_problem_list', name='open_ended_problems'),
# Cohorts management
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/cohorts$',
'course_groups.views.list_cohorts', name="cohorts"),
@@ -369,6 +369,12 @@ if settings.MITX_FEATURES.get('ENABLE_SQL_TRACKING_LOGS'):
url(r'^event_logs/(?P<args>.+)$', 'track.views.view_tracking_log'),
)
# FoldIt views
urlpatterns += (
# The path is hardcoded into their app...
url(r'^comm/foldit_ops', 'foldit.views.foldit_ops', name="foldit_ops"),
)
urlpatterns = patterns(*urlpatterns)
if settings.DEBUG: