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

Commit 88d03c2

Browse files
committed
⚗️ Experimenting to switch to SQL
1 parent 99a60c7 commit 88d03c2

2 files changed

Lines changed: 395 additions & 3 deletions

File tree

runestone/hparsons/hparsons.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class HParsonsDirective(Assessment):
9292
:textentry: if you will use text entry instead of horizontal parsons
9393
:hidetests: if the unittests will be hidden from learners
9494
:nostrictmatch: if the answer is required to match the whole string. if not selected, the tool will add ^ and $ automatically to the answer to force matching the full string. This does not affect the test string area.
95+
:language: SQL or regex
9596
9697
--problem--
9798
Here is the problem description.
@@ -102,13 +103,13 @@ class HParsonsDirective(Assessment):
102103
--explanations--
103104
explanations for block 1
104105
explanations for block 2
105-
--positive test string--
106+
--positive test string-- (this is only for regex)
106107
this is some positive test string.
107108
it can be more than one line.
108109
just ignore this section if you do not want to put anything in there.
109-
--negative test string--
110+
--negative test string-- (this is only for regex)
110111
this is some negative test string.
111-
--test cases--
112+
--test cases-- (this is only for regex)
112113
input string 1
113114
['expected match 1', 'expected match 2']
114115
input string 2
@@ -154,6 +155,17 @@ def run(self):
154155
else:
155156
self.options['nostrictmatch'] = ''
156157

158+
# SQL Options copied from activecode
159+
if "dburl" in self.options:
160+
self.options["dburl"] = "data-dburl='{}'".format(self.options["dburl"])
161+
else:
162+
self.options["dburl"] = ""
163+
164+
if "showlastsql" in self.options:
165+
self.options["showlastsql"] = 'data-showlastsql="true"'
166+
else:
167+
self.options["showlastsql"] = ""
168+
157169
self.assert_has_content()
158170

159171
# sepcifying the start end end for each section

0 commit comments

Comments
 (0)