Commit 1dcaf21f by kimth

Send idhash

parent 9734347c
......@@ -16,6 +16,7 @@ import numpy
import random
import re
import requests
import time
import traceback
import hashlib
import abc
......@@ -1124,7 +1125,9 @@ class CodeResponse(LoncapaResponse):
qinterface = self.system.xqueue['interface']
# Generate header
queuekey = xqueue_interface.make_hashkey(str(self.system.seed)+self.answer_id)
queuekey = xqueue_interface.make_hashkey(str(self.system.seed) + str(time.time()) +
str(self.system.xqueue['student_identifier']) +
self.answer_id)
xheader = xqueue_interface.make_xheader(lms_callback_url=self.system.xqueue['callback_url'],
lms_key=queuekey,
queue_name=self.queue_name)
......@@ -1137,6 +1140,11 @@ class CodeResponse(LoncapaResponse):
contents = self.payload.copy()
# Anonymized student identifier to the external grader
student_identifier_hash = xqueue_interface.make_hashkey(self.system.xqueue['student_identifier'])
student_info = {'student_identifier_hash': student_identifier_hash}
contents.update({'student_info': json.dumps(student_info)})
# Submit request. When successful, 'msg' is the prior length of the queue
if is_list_of_files(submission):
contents.update({'student_response': ''}) # TODO: Is there any information we want to send here?
......
......@@ -5,20 +5,17 @@ import hashlib
import json
import logging
import requests
import time
log = logging.getLogger('mitx.' + __name__)
def make_hashkey(seed=None):
def make_hashkey(seed):
'''
Generate a string key by hashing
'''
h = hashlib.md5()
if seed is not None:
h.update(str(seed))
h.update(str(time.time()))
h.update(str(seed))
return h.hexdigest()
......
......@@ -217,7 +217,9 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
xqueue = {'interface': xqueue_interface,
'callback_url': xqueue_callback_url,
'default_queuename': xqueue_default_queuename.replace(' ', '_')}
'default_queuename': xqueue_default_queuename.replace(' ', '_'),
'student_identifier': user.id,
}
def inner_get_module(location):
"""
......
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