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

Commit b369c04

Browse files
authored
Merge branch 'master' into docs
2 parents 41dc164 + 0d962dd commit b369c04

5 files changed

Lines changed: 60 additions & 10 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: ['3.7', '3.8']
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- uses: actions/setup-node@v2.1.2
23+
- name: Setup npm and build runestone.js
24+
run: |
25+
npm install
26+
npm run build
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
python -m pip install flake8 pytest
35+
pip install .
36+
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
37+
- name: Test with pytest
38+
run: |
39+
pytest

runestone/common/js/runestonebase.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export default class RunestoneBase {
179179
}
180180
} else {
181181
this.loadData({});
182+
this.csresolver("not taken");
182183
}
183184
} else {
184185
this.checkLocalStorage(); // just go right to local storage

runestone/parsons/js/parsons.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export default class Parsons extends RunestoneBase {
9090
this.checkServer("parsons");
9191
} else {
9292
this.checkLocalStorage();
93+
this.checkServerComplete = Promise.resolve("no server");
9394
}
9495
this.caption = "Parsons";
9596
this.addCaption("runestone");
@@ -661,7 +662,8 @@ export default class Parsons extends RunestoneBase {
661662
this.blocksFromHash(answerHash),
662663
options
663664
);
664-
this.grader.grade();
665+
this.grade = this.grader.grade();
666+
this.correct = this.grade;
665667
}
666668
// Start the interface
667669
if (this.needsReinitialization !== true) {
@@ -753,7 +755,7 @@ export default class Parsons extends RunestoneBase {
753755
event.adaptive = adaptiveHash;
754756
act = act + "|" + adaptiveHash;
755757
}
756-
if (this.answer == "correct") {
758+
if (this.grade == "correct") {
757759
act = "correct|" + act;
758760
event.correct = "T";
759761
} else {
@@ -1283,6 +1285,7 @@ export default class Parsons extends RunestoneBase {
12831285
this.grade = this.grader.grade();
12841286
if (this.grade == "correct") {
12851287
this.hasSolved = true;
1288+
this.correct = true;
12861289
localStorage.setItem(this.adaptiveId + "Solved", true);
12871290
this.recentAttempts = this.checkCount;
12881291
this.checkCount = 0;
@@ -2062,6 +2065,7 @@ export default class Parsons extends RunestoneBase {
20622065
async disableInteraction() {
20632066
// Disable blocks
20642067
await this.checkServerComplete;
2068+
console.log("disabling blocks");
20652069
if (this.blocks !== undefined) {
20662070
for (var i = 0; i < this.blocks.length; i++) {
20672071
var block = this.blocks[i];

runestone/timed/js/timed.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export default class Timed extends RunestoneBase {
103103
// If a user has not taken this exam then we want to make sure
104104
// that if a question has been seen by the student before we do
105105
// not populate previous answers.
106-
let response = Promise.resolve();
107106
let sendInfo = {
108107
div_id: this.divid,
109108
course_name: eBookConfig.course,
@@ -118,24 +117,27 @@ export default class Timed extends RunestoneBase {
118117
body: JSON.stringify(sendInfo),
119118
}
120119
);
121-
response = await fetch(request);
120+
let response = await fetch(request);
122121
let data = await response.json();
123122
this.taken = data.tookAssessment;
124123
this.assessmentTaken = this.taken;
125124
if (!this.taken) {
126125
localStorage.clear();
127126
}
127+
console.log("done with check status");
128+
return response;
128129
} else {
129130
this.taken = false;
130131
this.assessmentTaken = false;
132+
return Promise.resolve();
131133
}
132-
return response;
133134
}
134135

135136
/*===============================
136137
=== Generating new Timed HTML ===
137138
===============================*/
138139
renderTimedAssess() {
140+
console.log("rendering timed ");
139141
// create renderedQuestionArray returns a promise
140142
//
141143
this.createRenderedQuestionArray();
@@ -153,7 +155,8 @@ export default class Timed extends RunestoneBase {
153155
// Replace intermediate HTML with rendered HTML
154156
$(this.origElem).replaceWith(this.assessDiv);
155157
// check if already taken and if so show results
156-
this.tookTimedExam(); // rename to renderPossibleResults
158+
this.styleExamElements(); // rename to renderPossibleResults
159+
this.checkServer("timedExam");
157160
}
158161

159162
renderContainer() {
@@ -234,7 +237,9 @@ export default class Timed extends RunestoneBase {
234237
}.bind(this),
235238
false
236239
);
237-
this.controlDiv.appendChild(this.startBtn);
240+
if (!this.taken) {
241+
this.controlDiv.appendChild(this.startBtn);
242+
}
238243
if (!this.nopause) {
239244
this.controlDiv.appendChild(this.pauseBtn);
240245
}
@@ -734,7 +739,8 @@ export default class Timed extends RunestoneBase {
734739
);
735740
}
736741
}
737-
tookTimedExam() {
742+
743+
styleExamElements() {
738744
// Checks if this exam has been taken before
739745
$(this.timerContainer).css({
740746
width: "50%",
@@ -758,7 +764,6 @@ export default class Timed extends RunestoneBase {
758764
"background-color": "black",
759765
color: "white",
760766
});
761-
this.checkServer("timedExam");
762767
}
763768

764769
finishAssessment() {
@@ -821,6 +826,7 @@ export default class Timed extends RunestoneBase {
821826
let currentQuestion = this.renderedQuestionArray[i];
822827
// set the state to forreview so we know that feedback may be appropriate
823828
currentQuestion.state = "forreview";
829+
currentQuestion.question.disableInteraction();
824830
}
825831

826832
if (!this.showFeedback) {

runestone/unittest_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def setUp(self):
221221
self.driver.implicitly_wait(5)
222222
# For cases where an implicit wait does not help. For example waiting for text to appear
223223
# after running an activecode. We create an explicit wait object.
224-
self.wait = WebDriverWait(self.driver, 5)
224+
self.wait = WebDriverWait(self.driver, 10)
225225

226226
def tearDown(self):
227227
# Clear as much as possible, to present an almost-fresh instance of a browser for the next test. (Shutting down then starting up a browswer is very slow.)

0 commit comments

Comments
 (0)