Skip to content

Commit

Permalink
Added a condition for drag&drop functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
SheetalKashid committed Jun 25, 2019
1 parent f10b3eb commit 946d1d0
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions gnowsys-ndf/gnowsys_ndf/ndf/views/gcourse.py
Original file line number Diff line number Diff line change
Expand Up @@ -3918,26 +3918,27 @@ def get_attempts(question, MC):
for each attempt """
#print "Question Received:",question
item = get_item(question['itemId'], MC)
#print "Item Id's: for each assessment taken",item['_id']
# print "Item Id's: for each assessment taken",item['_id']
if item:

# print "Item Id:",item['_id']
if (question['responses'] and
'missingResponse' not in question['responses'][0]):
response = question['responses'][0]
#print "Each Item/Question Response",response
# print "Each Item/Question Response",response

if 'choiceIds' in response :
# Need to account for multiple choice, MW sentence, etc.
# So may have more than one `choiceId`.
attempts = [' '.join(
[get_choice_text(choice_id, item)
for choice_id in response['choiceIds']])]

#Need to account for Drag and Drop Activity
elif 'choiceIds' in response['inlineRegions']['RESPONSE_1']:
# print "Each Response for drag drop Assessment:",response['inlineRegions']['RESPONSE_1']['choiceIds']
attempts =[' '.join([get_c_text(choice_id,item) for choice_id in response['inlineRegions']['RESPONSE_1']['choiceIds']])]
# print "Each single Attempt Response for drag drop Assessment:",attempts
elif response.get('inlineRegions'):
if 'choiceIds' in response['inlineRegions']['RESPONSE_1']:
# print "Each Response for drag drop Assessment:",response['inlineRegions']['RESPONSE_1']['choiceIds']
attempts =[' '.join([get_c_text(choice_id,item) for choice_id in response['inlineRegions']['RESPONSE_1']['choiceIds']])]
# print "Each single Attempt Response for drag drop Assessment:",attempts
elif 'text' in response:
attempts = [response['text']['text']]
elif 'fileIds' in response and response['fileIds'] != {}:
Expand Down Expand Up @@ -3967,10 +3968,11 @@ def get_attempts(question, MC):
for choice_id in additional_attempt['choiceIds']]))

#Need to account for Drag and Drop Activity
elif 'choiceIds' in additional_attempt['inlineRegions']['RESPONSE_1']:
attempts.append(' '.join([get_c_text(choice_id,item) for choice_id in additional_attempt['inlineRegions']['RESPONSE_1']['choiceIds']]))
# print "Each additional Attempt Response for drag drop Assessment:",attempts
#print "Each Response for drag drop Assessment:",additional_attempt['inlineRegions']['RESPONSE_1']['choiceIds']
elif additional_attempt.get('inlineRegions'):
if 'choiceIds' in additional_attempt['inlineRegions']['RESPONSE_1']:
attempts.append(' '.join([get_c_text(choice_id,item) for choice_id in additional_attempt['inlineRegions']['RESPONSE_1']['choiceIds']]))
# print "Each additional Attempt Response for drag drop Assessment:",attempts
#print "Each Response for drag drop Assessment:",additional_attempt['inlineRegions']['RESPONSE_1']['choiceIds']
elif 'text' in additional_attempt:
attempts.append(additional_attempt['text']['text'])
elif ('fileIds' in additional_attempt and
Expand Down Expand Up @@ -4045,7 +4047,7 @@ def course_assessment_data(request,group_id,node_id,all_data=False):
print "\n"
MC=MongoClient("localhost",27017)
results = get_assessment_results(offered_id, MC)
#print "Assessment results:",results
# print "Assessment results:",results
# print type(results)

group_obj = Group.get_group_name_id(group_id, get_obj=True)
Expand Down

0 comments on commit 946d1d0

Please sign in to comment.