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

Commit 377ea65

Browse files
committed
Allow multiple experiments
1 parent 64dfe58 commit 377ea65

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

runestone/selectquestion/js/selectone.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class SelectOne extends RunestoneBase {
3737
this.not_seen_ever = $(opts.orig).data("not_seen_ever");
3838
this.selector_id = $(opts.orig).first().attr("id");
3939
this.primaryOnly = $(opts.orig).data("primary");
40-
this.isAB = $(opts.orig).data("ab");
40+
this.ABExperiment = $(opts.orig).data("ab");
4141
opts.orig.id = this.selector_id;
4242
}
4343
/**
@@ -73,8 +73,8 @@ export default class SelectOne extends RunestoneBase {
7373
if (this.primaryOnly) {
7474
data.primary = this.primaryOnly;
7575
}
76-
if (this.isAB) {
77-
data.AB = this.isAB;
76+
if (this.ABExperiment) {
77+
data.AB = this.ABExperiment;
7878
}
7979
let opts = this.origOpts;
8080
let selectorId = this.selector_id;

runestone/selectquestion/selectone.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class SelectQuestion(RunestoneIdDirective):
7070
:points: number of points for this question
7171
:min_difficulty: minimum difficulty level
7272
:max_difficulty: maximum difficulty level
73+
:ab: experiment_name
7374
7475
Difficulty is measured in one of two ways. For things like multiple choice and
7576
fill in the blank, we can use the % of students that get the answer correct on
@@ -91,7 +92,7 @@ class SelectQuestion(RunestoneIdDirective):
9192
"autogradable": directives.flag,
9293
"not_seen_ever": directives.flag,
9394
"primary": directives.flag,
94-
"ab": directives.flag,
95+
"ab": directives.unchanged,
9596
}
9697
)
9798

@@ -167,7 +168,7 @@ def run(self):
167168
self.options["primary"] = ""
168169

169170
if "ab" in self.options:
170-
self.options["AB"] = "data-ab=true"
171+
self.options["AB"] = f"data-ab={self.options['ab']}"
171172
else:
172173
self.options["AB"] = ""
173174

0 commit comments

Comments
 (0)