Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit be3c634

Browse files
committed
create shell for group submit
1 parent cf73f76 commit be3c634

6 files changed

Lines changed: 440 additions & 5 deletions

File tree

runestone/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@
55

66
from .activecode import ActiveCode
77
from .animation import Animation
8-
from .mchoice import MChoice, QuestionNumber
98
from .blockly import Blockly
10-
from .quizly import Quizly
11-
from .khanex import Khanex
129
from .codelens import Codelens
1310
from .clickableArea import ClickableArea
1411
from .datafile import DataFile
1512
from .disqus import DisqusDirective
1613
from .dragndrop import DragNDrop
1714
from .fitb import FillInTheBlank
15+
from .groupsub import GroupSubmission
16+
from .khanex import Khanex
1817
from .selectquestion import SelectQuestion
1918
from .matrixeq import MatrixEq
19+
from .mchoice import MChoice, QuestionNumber
2020
from .meta import Meta
2121
from .parsons import ParsonsProblem
2222
from .poll import Poll
23+
from .quizly import Quizly
2324
from .reveal import RevealDirective
2425
from .shortanswer import JournalDirective
2526
from .showeval import ShowEval
@@ -146,8 +147,8 @@ def setup(app):
146147
try:
147148
for c in setup.custom_js_files:
148149
if isinstance(c, dict):
149-
#peel off filename, pass rest of key/values on as kwargs
150-
filename = c.pop("file")
150+
# peel off filename, pass rest of key/values on as kwargs
151+
filename = c.pop("file")
151152
app.add_autoversioned_javascript(filename, **c)
152153
else:
153154
app.add_autoversioned_javascript(c)
@@ -244,6 +245,7 @@ def build(options):
244245
"datafile": DataFile,
245246
"disqus": DisqusDirective,
246247
"dragndrop": DragNDrop,
248+
"groupsub": GroupSubmission,
247249
"parsonsprob": ParsonsProblem,
248250
"poll": Poll,
249251
"quizly": Quizly,

runestone/groupsub/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .groupsub import *

runestone/groupsub/groupsub.py

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# *********************************
2+
# |docname| - An Group Submissions
3+
# *********************************
4+
#
5+
# This directive lets you specify a question by random selection
6+
# Given a list of question ids, it will randomly select one of those ids
7+
# to present to the student.
8+
# given a competency it will select a random question from all questions that
9+
# test for that competency.
10+
11+
# Copyright (C) 2021 Runestone Interactive LLC
12+
#
13+
# This program is free software: you can redistribute it and/or modify
14+
# it under the terms of the GNU General Public License as published by
15+
# the Free Software Foundation, either version 3 of the License, or
16+
# (at your option) any later version.
17+
#
18+
# This program is distributed in the hope that it will be useful,
19+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
# GNU General Public License for more details.
22+
#
23+
# You should have received a copy of the GNU General Public License
24+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+
#
26+
27+
__author__ = "bmiller"
28+
29+
# Imports from standard libarary
30+
# ------------------------------
31+
32+
# Imports from third party libraries
33+
# ----------------------------------
34+
from docutils import nodes
35+
from docutils.parsers.rst import directives
36+
37+
# local imports
38+
# -------------
39+
from runestone.server.componentdb import (
40+
addQuestionToDB,
41+
addHTMLToDB,
42+
maybeAddToAssignment,
43+
)
44+
from runestone.common.runestonedirective import (
45+
RunestoneDirective,
46+
)
47+
48+
49+
TEMPLATE = """
50+
<div class="runestone alert alert-warning sqcontainer">
51+
<div data-component="groupsub" id={component_id} {size_limit}>
52+
<div class="col-sm-3">
53+
<select id="assignment_group" multiple class="assignment_partner_select" style="width: 100%">
54+
</select>
55+
</div>
56+
</div>
57+
</div>
58+
"""
59+
60+
61+
def setup(app):
62+
app.add_directive("groupsub", GroupSubmission)
63+
64+
65+
class GroupSubmission(RunestoneDirective):
66+
"""
67+
.. groupsub:: uniqueid
68+
:limit: int
69+
:question_list:
70+
71+
For a POGIL or groupwork page to allow one partner to submit answers
72+
to all questions on the page for everyone in the group.
73+
Question list is an anticipated extension that will allow the author
74+
to specify a list of questions rather than assuming all.
75+
"""
76+
77+
required_arguments = 1
78+
optional_arguments = 1
79+
has_content = False
80+
option_spec = RunestoneDirective.option_spec.copy()
81+
option_spec.update(
82+
{
83+
"limit": directives.unchanged,
84+
}
85+
)
86+
87+
def __init__(self, *args, **kwargs):
88+
super().__init__(*args, **kwargs)
89+
90+
def run(self):
91+
92+
self.options["component_id"] = self.arguments[0].strip()
93+
94+
if "limit" in self.options:
95+
self.options["size_limit"] = f"size_limit={self.options['limit']}"
96+
else:
97+
self.options["size_limit"] = f"size_limit=4"
98+
99+
res = TEMPLATE.format(**self.options)
100+
101+
return [nodes.raw(self.block_text, res, format="html")]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
======================================================
2+
Testing: Multiple Choice and Multiple Answer Questions
3+
======================================================
4+
5+
Multiple Answer
6+
===============
7+
Old style
8+
---------
9+
.. mchoice:: test_mchoice_1
10+
:multiple_answers:
11+
:correct: a, c
12+
:answer_a: red
13+
:answer_b: brown
14+
:answer_c: blue
15+
:answer_d: gray
16+
:feedback_a: Red it is.
17+
:feedback_b: Not brown.
18+
:feedback_c: Blue it is.
19+
:feedback_d: Not gray.
20+
21+
Which colors might be found in a rainbow (check all)?
22+
23+
New style
24+
---------
25+
.. mchoice:: test_mchoice_1_new
26+
27+
Which colors might be found in a rainbow (check all)?
28+
29+
- red
30+
31+
+ Red it is.
32+
33+
- brown
34+
35+
- Not brown.
36+
37+
- blue
38+
39+
+ Blue it is.
40+
41+
- gray
42+
43+
- Not gray.
44+
45+
46+
Group Submission
47+
----------------
48+
49+
.. groupsub:: testgs_1
50+
51+
Group submit allows one person to submit answers for their entire group.
52+

0 commit comments

Comments
 (0)