change task_input field's type from CharField to TextField
This commit is contained in:
committed by
Noraiz Anwar
parent
f2be56c3fb
commit
570cd673ef
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.21 on 2019-07-01 12:48
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('instructor_task', '0002_gradereportsetting'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='instructortask',
|
||||
name='task_input',
|
||||
field=models.TextField(),
|
||||
),
|
||||
]
|
||||
@@ -70,7 +70,7 @@ class InstructorTask(models.Model):
|
||||
task_type = models.CharField(max_length=50, db_index=True)
|
||||
course_id = CourseKeyField(max_length=255, db_index=True)
|
||||
task_key = models.CharField(max_length=255, db_index=True)
|
||||
task_input = models.CharField(max_length=255)
|
||||
task_input = models.TextField()
|
||||
task_id = models.CharField(max_length=255, db_index=True) # max_length from celery_taskmeta
|
||||
task_state = models.CharField(max_length=50, null=True, db_index=True) # max_length from celery_taskmeta
|
||||
task_output = models.CharField(max_length=1024, null=True)
|
||||
@@ -99,15 +99,8 @@ class InstructorTask(models.Model):
|
||||
"""
|
||||
# create the task_id here, and pass it into celery:
|
||||
task_id = str(uuid4())
|
||||
|
||||
json_task_input = json.dumps(task_input)
|
||||
|
||||
# check length of task_input, and return an exception if it's too long:
|
||||
if len(json_task_input) > 265:
|
||||
fmt = u'Task input longer than 265: "{input}" for "{task}" of "{course}"'
|
||||
msg = fmt.format(input=json_task_input, task=task_type, course=course_id)
|
||||
raise ValueError(msg)
|
||||
|
||||
# create the task, then save it:
|
||||
instructor_task = cls(
|
||||
course_id=course_id,
|
||||
|
||||
@@ -126,28 +126,6 @@ class InstructorTaskModuleSubmitTest(InstructorTaskModuleTestCase):
|
||||
with self.assertRaises(NotImplementedError):
|
||||
submit_rescore_problem_for_all_students(request, problem_url)
|
||||
|
||||
def _test_submit_with_long_url(self, task_function, student=None):
|
||||
problem_url_name = 'x' * 255
|
||||
self.define_option_problem(problem_url_name)
|
||||
location = InstructorTaskModuleTestCase.problem_location(problem_url_name)
|
||||
with self.assertRaises(ValueError):
|
||||
if student is not None:
|
||||
task_function(self.create_task_request(self.instructor), location, student)
|
||||
else:
|
||||
task_function(self.create_task_request(self.instructor), location)
|
||||
|
||||
def test_submit_rescore_all_with_long_url(self):
|
||||
self._test_submit_with_long_url(submit_rescore_problem_for_all_students)
|
||||
|
||||
def test_submit_rescore_student_with_long_url(self):
|
||||
self._test_submit_with_long_url(submit_rescore_problem_for_student, self.student)
|
||||
|
||||
def test_submit_reset_all_with_long_url(self):
|
||||
self._test_submit_with_long_url(submit_reset_problem_attempts_for_all_students)
|
||||
|
||||
def test_submit_delete_all_with_long_url(self):
|
||||
self._test_submit_with_long_url(submit_delete_problem_state_for_all_students)
|
||||
|
||||
@ddt.data(
|
||||
(normalize_repr(submit_rescore_problem_for_all_students), 'rescore_problem'),
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user