Skip to content

Commit 33824bf

Browse files
authored
Merge pull request #81 from arbisoft/litmustest.staging
Litmustest.staging
2 parents e4eb7c7 + 024b14c commit 33824bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2951
-489
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,5 @@ test/selenium/screenshots/*
7373
logs/*.log*
7474

7575
edx-ora2/
76+
77+
openassessment/xblock/job_sample_grader/secret_data

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,20 @@ test-sandbox: test-acceptance test-a11y
101101
install-osx-requirements:
102102
brew install gettext
103103
brew link gettext --force
104+
105+
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
106+
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
107+
pip install -qr requirements/pip-tools.txt
108+
pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
109+
pip-compile --upgrade -o requirements/base.txt requirements/base.in
110+
pip-compile --upgrade -o requirements/test.txt requirements/test.in
111+
pip-compile --upgrade -o requirements/quality.txt requirements/quality.in
112+
# Delete django pin from test requirements to avoid tox version collision
113+
sed -i.tmp '/^[d|D]jango==/d' requirements/test.txt
114+
sed -i.tmp '/^djangorestframework==/d' requirements/test.txt
115+
# Delete extra metadata that causes build to fail
116+
sed -i.tmp '/^--index-url/d' requirements/*.txt
117+
sed -i.tmp '/^--extra-index-url/d' requirements/*.txt
118+
sed -i.tmp '/^--trusted-host/d' requirements/*.txt
119+
# Delete temporary files
120+
rm requirements/*.txt.tmp
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
**Add support to show input file read code in the editor by default**
2+
=======================================
3+
4+
Status
5+
------
6+
7+
*Approved*
8+
9+
Context
10+
-------
11+
12+
- Need to add an option to select if we want to add input file read code in the editor by default or not
13+
- Current behavior of editor:
14+
15+
- There is no option to see from where candidates have to read the input file in the editor
16+
17+
- There is no code available for reading input files
18+
19+
- Users need support on how to read files very frequently
20+
21+
- We need a solution where we can add an option in ORA settings that asks the author if the system should display input file-read code by default in the editor or not
22+
23+
Decisions
24+
---------
25+
26+
- An option to show read input file or not
27+
28+
- There should be a setting in ora that can be modified from the studio for each question where the author can select if the system should display input file read code or not
29+
30+
- Display the default read input file code in the editor
31+
32+
- Default read input file code will be loaded on language changed from the drop-down in the selected language
33+
- Refer to *Appendix A* for the example of a sample input file read code concerning language
34+
35+
- Default read input file code will only be displayed in the editor is empty or contains the default code of any language
36+
- Default read input file code will only displayed if author select true for value of `show_read_input_file_code`.
37+
38+
39+
Appendix A
40+
----------
41+
42+
**Sample input file read code example**:
43+
44+
.. code-block:: JSON
45+
46+
{
47+
"Python":"Default code of Python",
48+
"NodeJS":"Default code of NodeJs",
49+
"Java":"Default code of Java",
50+
"C++":"Default code of C++"
51+
}

openassessment/assessment/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import json
77

88
from django.contrib import admin
9-
from django.core.urlresolvers import reverse_lazy
9+
from django.urls import reverse_lazy
1010
from django.utils import html
1111

1212
from openassessment.assessment.models import Assessment, AssessmentFeedback, PeerWorkflow, PeerWorkflowItem, Rubric

openassessment/assessment/migrations/0001_initial.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Migration(migrations.Migration):
4747
fields=[
4848
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
4949
('feedback', models.TextField(default=b'', blank=True)),
50-
('assessment', models.ForeignKey(related_name='parts', to='assessment.Assessment')),
50+
('assessment', models.ForeignKey(related_name='parts', to='assessment.Assessment', on_delete=models.CASCADE)),
5151
],
5252
),
5353
migrations.CreateModel(
@@ -72,7 +72,7 @@ class Migration(migrations.Migration):
7272
('name', models.CharField(max_length=100)),
7373
('label', models.CharField(max_length=100, blank=True)),
7474
('explanation', models.TextField(max_length=10000, blank=True)),
75-
('criterion', models.ForeignKey(related_name='options', to='assessment.Criterion')),
75+
('criterion', models.ForeignKey(related_name='options', to='assessment.Criterion', on_delete=models.CASCADE)),
7676
],
7777
options={
7878
'ordering': ['criterion', 'order_num'],
@@ -102,9 +102,9 @@ class Migration(migrations.Migration):
102102
('submission_uuid', models.CharField(max_length=128, db_index=True)),
103103
('started_at', models.DateTimeField(default=django.utils.timezone.now, db_index=True)),
104104
('scored', models.BooleanField(default=False)),
105-
('assessment', models.ForeignKey(to='assessment.Assessment', null=True)),
106-
('author', models.ForeignKey(related_name='graded_by', to='assessment.PeerWorkflow')),
107-
('scorer', models.ForeignKey(related_name='graded', to='assessment.PeerWorkflow')),
105+
('assessment', models.ForeignKey(to='assessment.Assessment', null=True, on_delete=models.CASCADE)),
106+
('author', models.ForeignKey(related_name='graded_by', to='assessment.PeerWorkflow', on_delete=models.CASCADE)),
107+
('scorer', models.ForeignKey(related_name='graded', to='assessment.PeerWorkflow', on_delete=models.CASCADE)),
108108
],
109109
options={
110110
'ordering': ['started_at', 'id'],
@@ -147,33 +147,33 @@ class Migration(migrations.Migration):
147147
('raw_answer', models.TextField(blank=True)),
148148
('content_hash', models.CharField(unique=True, max_length=40, db_index=True)),
149149
('options_selected', models.ManyToManyField(to='assessment.CriterionOption')),
150-
('rubric', models.ForeignKey(to='assessment.Rubric')),
150+
('rubric', models.ForeignKey(to='assessment.Rubric', on_delete=models.CASCADE)),
151151
],
152152
),
153153
migrations.AddField(
154154
model_name='studenttrainingworkflowitem',
155155
name='training_example',
156-
field=models.ForeignKey(to='assessment.TrainingExample'),
156+
field=models.ForeignKey(to='assessment.TrainingExample', on_delete=models.CASCADE),
157157
),
158158
migrations.AddField(
159159
model_name='studenttrainingworkflowitem',
160160
name='workflow',
161-
field=models.ForeignKey(related_name='items', to='assessment.StudentTrainingWorkflow'),
161+
field=models.ForeignKey(related_name='items', to='assessment.StudentTrainingWorkflow', on_delete=models.CASCADE),
162162
),
163163
migrations.AddField(
164164
model_name='criterion',
165165
name='rubric',
166-
field=models.ForeignKey(related_name='criteria', to='assessment.Rubric'),
166+
field=models.ForeignKey(related_name='criteria', to='assessment.Rubric', on_delete=models.CASCADE),
167167
),
168168
migrations.AddField(
169169
model_name='assessmentpart',
170170
name='criterion',
171-
field=models.ForeignKey(related_name='+', to='assessment.Criterion'),
171+
field=models.ForeignKey(related_name='+', to='assessment.Criterion', on_delete=models.CASCADE),
172172
),
173173
migrations.AddField(
174174
model_name='assessmentpart',
175175
name='option',
176-
field=models.ForeignKey(related_name='+', to='assessment.CriterionOption', null=True),
176+
field=models.ForeignKey(related_name='+', to='assessment.CriterionOption', null=True, on_delete=models.CASCADE),
177177
),
178178
migrations.AddField(
179179
model_name='assessmentfeedback',
@@ -183,7 +183,7 @@ class Migration(migrations.Migration):
183183
migrations.AddField(
184184
model_name='assessment',
185185
name='rubric',
186-
field=models.ForeignKey(to='assessment.Rubric'),
186+
field=models.ForeignKey(to='assessment.Rubric', on_delete=models.CASCADE),
187187
),
188188
migrations.AlterUniqueTogether(
189189
name='studenttrainingworkflowitem',

openassessment/assessment/models/base.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def content_hash_from_dict(rubric_dict):
109109
rubric_dict.pop("content_hash", None)
110110

111111
canonical_form = json.dumps(rubric_dict, sort_keys=True)
112-
return sha1(canonical_form).hexdigest()
112+
return sha1(canonical_form.encode('utf-8')).hexdigest()
113113

114114
@staticmethod
115115
def structure_hash_from_dict(rubric_dict):
@@ -141,7 +141,7 @@ def structure_hash_from_dict(rubric_dict):
141141
for criterion in rubric_dict.get('criteria', [])
142142
]
143143
canonical_form = json.dumps(structure, sort_keys=True)
144-
return sha1(canonical_form).hexdigest()
144+
return sha1(canonical_form.encode('utf-8')).hexdigest()
145145

146146

147147
class Criterion(models.Model):
@@ -152,7 +152,7 @@ class Criterion(models.Model):
152152
153153
All Rubrics have at least one Criterion.
154154
"""
155-
rubric = models.ForeignKey(Rubric, related_name="criteria")
155+
rubric = models.ForeignKey(Rubric, related_name="criteria", on_delete=models.CASCADE)
156156

157157
# Backwards compatibility: The "name" field was formerly
158158
# used both as a display name and as a unique identifier.
@@ -192,7 +192,7 @@ class CriterionOption(models.Model):
192192
Assessment. That state is stored in :class:`AssessmentPart`.
193193
"""
194194
# All Criteria must have at least one CriterionOption.
195-
criterion = models.ForeignKey(Criterion, related_name="options")
195+
criterion = models.ForeignKey(Criterion, related_name="options", on_delete=models.CASCADE)
196196

197197
# 0-based order in Criterion
198198
order_num = models.PositiveIntegerField()
@@ -417,7 +417,7 @@ class Assessment(models.Model):
417417
MAX_FEEDBACK_SIZE = 1024 * 100
418418

419419
submission_uuid = models.CharField(max_length=128, db_index=True)
420-
rubric = models.ForeignKey(Rubric)
420+
rubric = models.ForeignKey(Rubric, on_delete=models.CASCADE)
421421

422422
scored_at = models.DateTimeField(default=now, db_index=True)
423423
scorer_id = models.CharField(max_length=40, db_index=True)
@@ -613,16 +613,16 @@ class AssessmentPart(models.Model):
613613
"""
614614
MAX_FEEDBACK_SIZE = 1024 * 100
615615

616-
assessment = models.ForeignKey(Assessment, related_name='parts')
616+
assessment = models.ForeignKey(Assessment, related_name='parts', on_delete=models.CASCADE)
617617

618618
# Assessment parts are usually associated with an option
619619
# (representing the point value selected for a particular criterion)
620620
# It's possible, however, for an assessment part to contain
621621
# only written feedback, with no point value.
622622
# In this case, the assessment part is associated with a criterion,
623623
# but not with any option (the `option` field is set to null).
624-
criterion = models.ForeignKey(Criterion, related_name="+")
625-
option = models.ForeignKey(CriterionOption, null=True, related_name="+")
624+
criterion = models.ForeignKey(Criterion, related_name="+", on_delete=models.CASCADE)
625+
option = models.ForeignKey(CriterionOption, null=True, related_name="+", on_delete=models.CASCADE)
626626

627627
# Free-form text feedback for the specific criterion
628628
# Note that the `Assessment` model also has a feedback field,

openassessment/assessment/models/peer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,11 @@ class PeerWorkflowItem(models.Model):
440440
assessment represents the completed assessment for this work item.
441441
442442
"""
443-
scorer = models.ForeignKey(PeerWorkflow, related_name='graded')
444-
author = models.ForeignKey(PeerWorkflow, related_name='graded_by')
443+
scorer = models.ForeignKey(PeerWorkflow, related_name='graded', on_delete=models.CASCADE)
444+
author = models.ForeignKey(PeerWorkflow, related_name='graded_by', on_delete=models.CASCADE)
445445
submission_uuid = models.CharField(max_length=128, db_index=True)
446446
started_at = models.DateTimeField(default=now, db_index=True)
447-
assessment = models.ForeignKey(Assessment, null=True)
447+
assessment = models.ForeignKey(Assessment, null=True, on_delete=models.CASCADE)
448448

449449
# This WorkflowItem was used to determine the final score for the Workflow.
450450
scored = models.BooleanField(default=False)

openassessment/assessment/models/student_training.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ class StudentTrainingWorkflowItem(models.Model):
187187
if there are no examples left, the student has
188188
successfully completed training.
189189
"""
190-
workflow = models.ForeignKey(StudentTrainingWorkflow, related_name="items")
190+
workflow = models.ForeignKey(StudentTrainingWorkflow, related_name="items", on_delete=models.CASCADE)
191191
order_num = models.PositiveIntegerField()
192192
started_at = models.DateTimeField(auto_now_add=True)
193193
completed_at = models.DateTimeField(default=None, null=True)
194-
training_example = models.ForeignKey(TrainingExample)
194+
training_example = models.ForeignKey(TrainingExample, on_delete=models.CASCADE)
195195

196196
class Meta:
197197
app_label = "assessment"

openassessment/assessment/models/training.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TrainingExample(models.Model):
2121
# The answer (JSON-serialized)
2222
raw_answer = models.TextField(blank=True)
2323

24-
rubric = models.ForeignKey(Rubric)
24+
rubric = models.ForeignKey(Rubric, on_delete=models.CASCADE)
2525

2626
# Use a m2m to avoid changing the criterion option
2727
options_selected = models.ManyToManyField(CriterionOption)
@@ -137,7 +137,7 @@ def calculate_hash(answer, options_selected, rubric):
137137
'options_selected': options_selected,
138138
'rubric': rubric.id
139139
})
140-
return sha1(contents).hexdigest()
140+
return sha1(contents.encode('utf-8')).hexdigest()
141141

142142
@classmethod
143143
def cache_key(cls, answer, options_selected, rubric):

openassessment/fileupload/backends/django_storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from django.core.files.base import ContentFile
66
from django.core.files.storage import default_storage
7-
from django.core.urlresolvers import reverse
7+
from django.urls import reverse
88

99
from .base import BaseBackend
1010

0 commit comments

Comments
 (0)