Skip to content

Commit 81af1dd

Browse files
committed
fix: autformat problem block html files
1 parent 610e2ab commit 81af1dd

44 files changed

Lines changed: 1537 additions & 1445 deletions

Some content is hidden

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

xmodule/capa/score_render.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Score rendering when submission is evaluated for external grader and has been saved successfully
33
"""
4+
45
import logging
56
from functools import partial
67

@@ -20,10 +21,10 @@
2021

2122

2223
def load_xblock_for_external_grader(
23-
user_id: str,
24-
course_key: CourseKey,
25-
usage_key: UsageKey,
26-
course=None,
24+
user_id: str,
25+
course_key: CourseKey,
26+
usage_key: UsageKey,
27+
course=None,
2728
):
2829
"""
2930
Load a single XBlock for external grading without user access checks.
@@ -38,19 +39,13 @@ def load_xblock_for_external_grader(
3839
log.exception(f"Could not find block {usage_key} in modulestore: {e}")
3940
raise Http404(f"Module {usage_key} was not found") from e
4041

41-
field_data_cache = FieldDataCache.cache_for_block_descendents(
42-
course_key, user, block, depth=0
43-
)
42+
field_data_cache = FieldDataCache.cache_for_block_descendents(course_key, user, block, depth=0)
4443

4544
student_kvs = DjangoKeyValueStore(field_data_cache)
4645
student_data = KvsFieldData(student_kvs)
4746

4847
instance = get_block_for_descriptor_without_access_check(
49-
user=user,
50-
block=block,
51-
student_data=student_data,
52-
course_key=course_key,
53-
course=course
48+
user=user, block=block, student_data=student_data, course_key=course_key, course=course
5449
)
5550

5651
if instance is None:
Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,61 @@
11
{% load static %}
22
<div class="annotation-input">
3-
<div class="script_placeholder" data-src="{% static 'js/capa/annotationinput.js' %}"/>
4-
5-
<div class="annotation-header">
6-
{{ title|safe }}
7-
8-
{% if return_to_annotation %}
9-
<a class="annotation-return" href="javascript:void(0)">Return to Annotation</a><br/>
10-
{% endif %}
11-
</div>
12-
<div class="annotation-body">
13-
14-
<div class="block block-highlight">{{ text|safe }}</div>
15-
<div class="block block-comment">{{ comment|safe }}</div>
16-
17-
<div class="block">{{ comment_prompt|safe }}</div>
18-
<textarea class="comment" id="input_{{ id }}_comment" name="input_{{ id }}_comment" aria-describedby="answer_{{ id }}">{{ comment_value|safe }}</textarea>
19-
20-
<div class="block" id="label_{{ id }}">{{ tag_prompt|safe }}</div>
21-
<ul class="tags">
22-
{% for option in options %}
23-
<li>
24-
{% if has_options_value %}
25-
{% if option.choice == status.classname and status == status.classname %}
26-
<span class="tag-status {{ status.classname }}" aria-describedby="input_{{ id }}_comment">
27-
{% include "status_span.html" with status=status %}
28-
</span>
29-
{% endif %}
30-
{% endif %}
31-
32-
<span class="tag
33-
{% if option.id in options_value %}
34-
selected
35-
{% endif %}
36-
" data-id="{{ option.id }}">
37-
{{ option.description|safe }}
38-
</span>
39-
</li>
40-
{% endfor %}
41-
</ul>
42-
43-
{% if debug %}
44-
<div class="debug-value">
45-
Rendered with value:<br/>
46-
<pre>{{ value|safe }}</pre>
47-
Current input value:<br/>
48-
<input type="text" class="value" name="input_{{ id }}" id="input_{{ id }}" value="{{ value }}" />
3+
<div class="script_placeholder"
4+
data-src="{% static 'js/capa/annotationinput.js' %}" />
5+
<div class="annotation-header">
6+
{{ title|safe }}
7+
{% if return_to_annotation %}
8+
<a class="annotation-return" href="javascript:void(0)">Return to Annotation</a>
9+
<br />
10+
{% endif %}
11+
</div>
12+
<div class="annotation-body">
13+
<div class="block block-highlight">{{ text|safe }}</div>
14+
<div class="block block-comment">{{ comment|safe }}</div>
15+
<div class="block">{{ comment_prompt|safe }}</div>
16+
<textarea class="comment"
17+
id="input_{{ id }}_comment"
18+
name="input_{{ id }}_comment"
19+
aria-describedby="answer_{{ id }}">{{ comment_value|safe }}</textarea>
20+
<div class="block" id="label_{{ id }}">{{ tag_prompt|safe }}</div>
21+
<ul class="tags">
22+
{% for option in options %}
23+
<li>
24+
{% if has_options_value %}
25+
{% if option.choice == status.classname and status == status.classname %}
26+
<span class="tag-status {{ status.classname }}"
27+
aria-describedby="input_{{ id }}_comment">
28+
{% include "status_span.html" with status=status %}
29+
</span>
30+
{% endif %}
31+
{% endif %}
32+
<span class="tag {% if option.id in options_value %}selected{% endif %} "
33+
data-id="{{ option.id }}">{{ option.description|safe }}</span>
34+
</li>
35+
{% endfor %}
36+
</ul>
37+
{% if debug %}
38+
<div class="debug-value">
39+
Rendered with value:
40+
<br />
41+
<pre>{{ value|safe }}</pre>
42+
Current input value:
43+
<br />
44+
<input type="text"
45+
class="value"
46+
name="input_{{ id }}"
47+
id="input_{{ id }}"
48+
value="{{ value }}" />
49+
</div>
50+
{% else %}
51+
<input type="hidden"
52+
class="value"
53+
name="input_{{ id }}"
54+
id="input_{{ id }}"
55+
value="{{ value }}" />
56+
{% endif %}
57+
{% include "status_span.html" with status=status status_id=id %}
58+
<p id="answer_{{ id }}" class="answer answer-annotation"></p>
4959
</div>
50-
{% else %}
51-
<input type="hidden" class="value" name="input_{{ id }}" id="input_{{ id }}" value="{{ value }}" />
52-
{% endif %}
53-
54-
{% include "status_span.html" with status=status status_id=id %}
55-
56-
<p id="answer_{{ id }}" class="answer answer-annotation"></p>
57-
</div>
5860
</div>
59-
60-
{% if msg %}
61-
<span class="message" aria-describedby="label_{{ id }}" tabindex="-1">{{ msg|safe }}</span>
62-
{% endif %}
61+
{% if msg %}<span class="message" aria-describedby="label_{{ id }}" tabindex="-1">{{ msg|safe }}</span>{% endif %}
Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
<div id="chemicalequationinput_{{ id }}" class="chemicalequationinput">
2-
<div class="script_placeholder" data-src="{{ previewer }}"/>
3-
2+
<div class="script_placeholder" data-src="{{ previewer }}" />
43
<div class="{{ status.classname }}">
5-
6-
<input type="text" name="input_{{ id }}" id="input_{{ id }}" aria-label="{{ response_data.label|striptags }}"
7-
aria-describedby="answer_{{ id }}" data-input-id="{{ id }}" value="{{ value }}"
8-
{% if size %}
9-
size="{{ size }}"
10-
{% endif %}
11-
/>
12-
13-
<p class="indicator-container">
14-
{{ value }}
15-
{% include "status_span.html" with status=status status_id=id %}
16-
</p>
17-
18-
<div id="input_{{ id }}_preview" class="equation"></div>
19-
<p id="answer_{{ id }}" class="answer"></p>
20-
</div>
4+
<input type="text"
5+
name="input_{{ id }}"
6+
id="input_{{ id }}"
7+
aria-label="{{ response_data.label|striptags }}"
8+
aria-describedby="answer_{{ id }}"
9+
data-input-id="{{ id }}"
10+
value="{{ value }}"
11+
{% if size %}size="{{ size }}"{% endif %} />
12+
<p class="indicator-container">
13+
{{ value }}
14+
{% include "status_span.html" with status=status status_id=id %}
15+
</p>
16+
<div id="input_{{ id }}_preview" class="equation"></div>
17+
<p id="answer_{{ id }}" class="answer"></p>
18+
</div>
2119
</div>
Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,41 @@
11
<div class="choicegroup capa_inputtype" id="inputtype_{{ id }}">
22
<fieldset {{ describedby_html }}>
3-
{% if response_data.label %}
4-
<legend id="{{ id }}-legend" class="response-fieldset-legend field-group-hd">{{ response_data.label }}</legend>
5-
{% endif %}
6-
{% for description_id, description_text in response_data.descriptions.items %}
7-
<p class="question-description" id="{{ description_id }}">{{ description_text|safe }}</p>
8-
{% endfor %}
3+
{% if response_data.label %}
4+
<legend id="{{ id }}-legend" class="response-fieldset-legend field-group-hd">{{ response_data.label }}</legend>
5+
{% endif %}
6+
{% for description_id, description_text in response_data.descriptions.items %}
7+
<p class="question-description" id="{{ description_id }}">{{ description_text|safe }}</p>
8+
{% endfor %}
99
{% for choice_id, choice_label in choices %}
10-
<div class="field">
11-
<input type="{{ input_type }}" name="input_{{ id }}{{ name_array_suffix }}" id="input_{{ id }}_{{ choice_id }}"
12-
class="field-input input-{{ input_type }}{% if input_type == 'radio' and choice_id == value or input_type != 'radio' and choice_id in value %} submitted{% endif %}" value="{{ choice_id }}"
13-
{# If the student selected this choice... #}
14-
{% if input_type == 'radio' and choice_id == value or input_type != 'radio' and choice_id in value %}
15-
checked="true"
16-
{% elif input_type != 'radio' and choice_id in value %}
17-
checked="true"
18-
{% endif %}
19-
/><label id="{{ id }}-{{ choice_id }}-label" for="input_{{ id }}_{{ choice_id }}"
20-
class="response-label field-label label-inline{% if choice_id in value and status.classname and show_correctness != 'never' %} choicegroup_{{ status.classname }}{% endif %}"
21-
{{ describedby_html }}
22-
>
23-
<div>
24-
{{ choice_label|safe }}
10+
<div class="field">
11+
<input type="{{ input_type }}" name="input_{{ id }}{{ name_array_suffix }}" id="input_{{ id }}_{{ choice_id }}"
12+
class="field-input input-{{ input_type }}{% if input_type == 'radio' and choice_id == value or input_type != 'radio' and choice_id in value %} submitted{% endif %}" value="{{ choice_id }}"
13+
{# If the student selected this choice... #}
14+
{% if input_type == 'radio' and choice_id == value or input_type != 'radio' and choice_id in value %}
15+
checked="true"
16+
{% elif input_type != 'radio' and choice_id in value %}
17+
checked="true"
18+
{% endif %}
19+
/>
20+
<label id="{{ id }}-{{ choice_id }}-label"
21+
for="input_{{ id }}_{{ choice_id }}"
22+
class="response-label field-label label-inline{% if choice_id in value and status.classname and show_correctness != 'never' %} choicegroup_{{ status.classname }}{% endif %}"
23+
{{ describedby_html }}>
24+
<div>{{ choice_label|safe }}</div>
25+
</label>
2526
</div>
26-
</label>
27-
</div>
28-
{% endfor %}
29-
<span id="answer_{{ id }}"></span>
30-
</fieldset>
31-
<div class="indicator-container">
32-
{% if show_correctness != 'never' %}
33-
{% include "status_span.html" with status=status status_id=id %}
34-
{% else %}
35-
{% include "status_span.html" with status=status status_id=id hide_correctness=True %}
27+
{% endfor %}
28+
<span id="answer_{{ id }}"></span>
29+
</fieldset>
30+
<div class="indicator-container">
31+
{% if show_correctness != 'never' %}
32+
{% include "status_span.html" with status=status status_id=id %}
33+
{% else %}
34+
{% include "status_span.html" with status=status status_id=id hide_correctness=True %}
35+
{% endif %}
36+
</div>
37+
{% if show_correctness == "never" %}
38+
{% if value or status != "unsubmitted" %}<div class="capa_alert">{{ submitted_message|safe }}</div>{% endif %}
3639
{% endif %}
37-
</div>
38-
{% if show_correctness == "never" %}
39-
{% if value or status != "unsubmitted" %}
40-
<div class="capa_alert">{{ submitted_message|safe }}</div>
41-
{% endif %}
42-
{% endif %}
43-
{% if msg %}
44-
<span class="message" aria-describedby="{{ id }}-legend" tabindex="-1">{{ msg|safe }}</span>
45-
{% endif %}
46-
</div>
40+
{% if msg %}<span class="message" aria-describedby="{{ id }}-legend" tabindex="-1">{{ msg|safe }}</span>{% endif %}
41+
</div>

0 commit comments

Comments
 (0)