From 7240d257261d2fb61627b9d70da07e6ae2fe34d8 Mon Sep 17 00:00:00 2001
From: maheshgudi
Date: Mon, 13 Nov 2017 16:44:53 +0530
Subject: Fix Error table layout in grade_user, view_answerpaper, user_data
---
yaksh/templates/yaksh/grade_user.html | 4 ++--
yaksh/templates/yaksh/user_data.html | 4 ++--
yaksh/templates/yaksh/view_answerpaper.html | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
(limited to 'yaksh')
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html
index 3339177..f52e6be 100644
--- a/yaksh/templates/yaksh/grade_user.html
+++ b/yaksh/templates/yaksh/grade_user.html
@@ -230,7 +230,7 @@ Status : Passed
{% endif %}
-
+
@@ -268,7 +268,7 @@ Status : Passed
{% endif %}
The following error took place:
-
+
Exception Name: |
diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html
index a0219dd..73157ff 100644
--- a/yaksh/templates/yaksh/user_data.html
+++ b/yaksh/templates/yaksh/user_data.html
@@ -150,7 +150,7 @@ User IP address: {{ paper.user_ip }}
{% endif %}
-
+
@@ -188,7 +188,7 @@ User IP address: {{ paper.user_ip }}
{% endif %}
The following error took place:
-
+
Exception Name: |
diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html
index fa16a08..b433ad5 100644
--- a/yaksh/templates/yaksh/view_answerpaper.html
+++ b/yaksh/templates/yaksh/view_answerpaper.html
@@ -143,7 +143,7 @@
{% endif %}
-
+
@@ -181,7 +181,7 @@
{% endif %}
The following error took place:
-
+
Exception Name: |
--
cgit
From a6fd44d9dd9c1e76929e715754bb4a215795b6b8 Mon Sep 17 00:00:00 2001
From: maheshgudi
Date: Mon, 13 Nov 2017 16:47:04 +0530
Subject: Fix regrader for new code server
---
yaksh/models.py | 16 +++++++++++++---
yaksh/templates/yaksh/grade_user.html | 7 +++----
2 files changed, 16 insertions(+), 7 deletions(-)
(limited to 'yaksh')
diff --git a/yaksh/models.py b/yaksh/models.py
index d698232..8e7089f 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -29,7 +29,9 @@ import tempfile
from textwrap import dedent
from ast import literal_eval
from .file_utils import extract_files, delete_files
-from yaksh.code_server import submit, SERVER_POOL_PORT
+from yaksh.code_server import(submit, SERVER_POOL_PORT,
+ get_result as get_result_from_code_server
+ )
from django.conf import settings
from django.forms.models import model_to_dict
@@ -1435,6 +1437,7 @@ class AnswerPaper(models.Model):
elif question.type == 'float':
tc_status = []
+ user_answer = float(user_answer)
for tc in question.get_test_cases():
if abs(tc.correct - user_answer) <= tc.error_margin:
tc_status.append(True)
@@ -1474,9 +1477,16 @@ class AnswerPaper(models.Model):
answer = user_answer.answer
json_data = question.consolidate_answer_data(answer) \
if question.type == 'code' else None
- result = self.validate_answer(answer, question, json_data)
+ result = self.validate_answer(answer, question,
+ json_data, user_answer.id)
+ if question.type == "code":
+ url = 'http://localhost:%s' % SERVER_POOL_PORT
+ check_result = get_result_from_code_server(url, result['uid'],
+ block=True
+ )
+ result = json.loads(check_result.get('result'))
user_answer.correct = result.get('success')
- user_answer.error = result.get('error')
+ user_answer.error = json.dumps(result.get('error'))
if result.get('success'):
if question.partial_grading and question.type == 'code':
max_weight = question.get_maximum_test_case_weight()
diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html
index f52e6be..1fef026 100644
--- a/yaksh/templates/yaksh/grade_user.html
+++ b/yaksh/templates/yaksh/grade_user.html
@@ -8,7 +8,6 @@
{% block content %}
{% block script %}
-