Commit 997188fb by Stephen Sanchez

Creating a debug page for evaluations. It is kind of great.

parent 3da5e45f
from django.contrib import admin
from openassessment.peer.models import PeerEvaluation
admin.site.register(PeerEvaluation)
<h3>Evaluations for {{ student_id }} > {{ course_id }} > {{ item_id }}:</h3>
{{ error }} <br/>
{{ evaluations|length }} total evaluations. <br/>
<br/>
<table border=1>
<th>Submission UUID</th>
<th>Points Earned</th>
<th>Points Possible</th>
<th>Scored At</th>
<th>Score Type</th>
<th>Feedback</th>
{% for evaluation in evaluations%}
<tr>
<td>{{ evaluation.submission_uuid }}</td>
<td>{{ evaluation.points_earned }}</td>
<td>{{ evaluation.points_possible }}</td>
<td>{{ evaluation.scorer_id }}</td>
<td>{{ evaluation.score_type }}</td>
<td>{{ evaluation.feedback }}</td>
</tr>
{% endfor %}
</table>
from django.conf.urls import patterns, url
urlpatterns = patterns(
'openassessment.peer.views',
url(
r'^(?P<student_id>[^/]+)/(?P<course_id>[^/]+)/(?P<item_id>[^/]+)$',
'get_evaluations_for_student_item'
),
)
import logging
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from openassessment.peer.api import get_evaluations
from submissions.api import SubmissionRequestError, get_submissions
log = logging.getLogger(__name__)
@login_required()
def get_evaluations_for_student_item(request, course_id, student_id, item_id):
"""Retrieve all evaluations associated with the given student item.
Developer utility for accessing all the evaluations associated with a
student item. The student item is specified by the unique combination of
course, student, and item.
Args:
request (dict): The request.
course_id (str): The course id for this student item.
student_id (str): The student id for this student item.
item_id (str): The item id for this student item.
Returns:
HttpResponse: The response object for this request. Renders a simple
development page with all the evaluations related to the specified
student item.
"""
student_item_dict = dict(
course_id=course_id,
student_id=student_id,
item_id=item_id,
)
context = dict(**student_item_dict)
try:
submissions = get_submissions(student_item_dict)
evaluations = []
for submission in submissions:
submission_evaluations = get_evaluations(submission["uuid"])
for evaluation in submission_evaluations:
evaluation["submission_uuid"] = submission["uuid"]
evaluations.append(evaluation)
context["evaluations"] = evaluations
except SubmissionRequestError:
context["error"] = "The specified student item was not found."
return render_to_response('evaluations.html', context)
...@@ -73,6 +73,7 @@ class Submission(models.Model): ...@@ -73,6 +73,7 @@ class Submission(models.Model):
def __repr__(self): def __repr__(self):
return repr(dict( return repr(dict(
uuid=self.uuid,
student_item=self.student_item, student_item=self.student_item,
attempt_number=self.attempt_number, attempt_number=self.attempt_number,
submitted_at=self.submitted_at, submitted_at=self.submitted_at,
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
{{ submissions|length }} total submissions. <br/> {{ submissions|length }} total submissions. <br/>
<br/> <br/>
<table border=1> <table border=1>
<th>Submission UUID</th>
<th>Student Item</th> <th>Student Item</th>
<th>Attempt Number</th> <th>Attempt Number</th>
<th>Answer</th> <th>Answer</th>
...@@ -10,6 +11,7 @@ ...@@ -10,6 +11,7 @@
<th>Created At</th> <th>Created At</th>
{% for submission in submissions%} {% for submission in submissions%}
<tr> <tr>
<td>{{ submission.uuid }}</td>
<td>{{ submission.student_item }}</td> <td>{{ submission.student_item }}</td>
<td>{{ submission.attempt_number }}</td> <td>{{ submission.attempt_number }}</td>
<td>{{ submission.answer }}</td> <td>{{ submission.answer }}</td>
......
from django.conf.urls import include, patterns, url from django.conf.urls import include, patterns, url
from django.contrib import admin from django.contrib import admin
import openassessment.peer.urls
import submissions.urls import submissions.urls
import workbench.urls import workbench.urls
...@@ -16,4 +17,7 @@ urlpatterns = patterns( ...@@ -16,4 +17,7 @@ urlpatterns = patterns(
# edx-tim apps # edx-tim apps
url(r'^submissions/', include(submissions.urls)), url(r'^submissions/', include(submissions.urls)),
# edx-tim apps
url(r'^peer/evaluations/', include(openassessment.peer.urls)),
) )
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