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

Commit 330f54e

Browse files
committed
Merge branch 'master' into grading
2 parents 28bce9b + f5d45dc commit 330f54e

File tree

6 files changed

+824
-671
lines changed

6 files changed

+824
-671
lines changed

poetry.lock

Lines changed: 777 additions & 657 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ license = "GPL"
3434
name = "runestone"
3535
readme = "README.rst"
3636
repository = "https://github.com/RunestoneInteractive/RunestoneComponents"
37-
version = "6.4.0"
37+
version = "6.4.4dev"
3838

3939
# See https://python-poetry.org/docs/pyproject/#include-and-exclude.
4040
include = [
@@ -90,7 +90,7 @@ jinja2 = "<3.1.0"
9090
Paver = ">=1.2.4"
9191
python = "^3.7.0"
9292
six = ">1.12"
93-
Sphinx = ">=4.4.0"
93+
Sphinx = ">=4.4.0,<6.0.0"
9494
sphinxcontrib-paverutils = ">=1.17"
9595
SQLAlchemy = ">=1.4.0"
9696

@@ -136,4 +136,4 @@ asyncio_mode = "auto"
136136

137137

138138
[tool.mypy]
139-
ignore_missing_imports = true
139+
ignore_missing_imports = true

runestone/activecode/js/activecode.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export class ActiveCode extends RunestoneBase {
121121
}
122122
suffStart = this.code.indexOf("====");
123123
if (suffStart > -1) {
124+
// The +5 gets past the ====\n
124125
this.suffix = this.code.substring(suffStart + 5);
125126
this.code = this.code.substring(0, suffStart);
126127
}

runestone/activecode/js/livecode.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ export default class LiveCode extends ActiveCode {
101101

102102
// extract the class names so files can be named properly
103103
if (this.suffix && this.language == "java") {
104+
// the suffix contains unit test code and should include and import of junit
105+
// import static org.junit.Assert.*;
106+
// import org.junit.*;
107+
// import java.io.*;
108+
if (this.suffix.indexOf("import org.junit") <0 ) {
109+
console.log(`Missing imports in unit tests:
110+
${this.suffix}`);
111+
// alert("The unit tests for this problem are incomplete, Please report this.");
112+
this.suffix = `
113+
import static org.junit.Assert.*;
114+
import org.junit.*;
115+
import java.io.*;
116+
` + this.suffix;
117+
}
104118
let classMatch = new RegExp(/public class\s+(\w+)[\s+{]/);
105119
source = await this.buildProg(false);
106120
let m = source.match(classMatch);

runestone/common/js/user-highlights.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ function getCompletions() {
2121
currentPathname.lastIndexOf("?")
2222
);
2323
}
24-
var data = { lastPageUrl: currentPathname };
24+
var data = {
25+
lastPageUrl: currentPathname,
26+
isPtxBook: isPreTeXt()
27+
};
2528
jQuery
2629
.ajax({
2730
url: `${eBookConfig.new_server_prefix}/logger/getCompletionStatus`,
@@ -40,7 +43,7 @@ function getCompletions() {
4043
completionClass = "buttonAskCompletion";
4144
completionMsg = "Mark as Completed";
4245
}
43-
$("#main-content").append(
46+
$("#scprogresscontainer").append(
4447
'<div style="text-align:center"><button class="btn btn-lg ' +
4548
completionClass +
4649
'" id="completionButton">' +
@@ -274,6 +277,14 @@ function enableCompletions() {
274277
// call enable user highlights after login
275278
$(document).on("runestone:login", enableCompletions);
276279

280+
function isPreTeXt() {
281+
let ptxMarker = document.querySelector("body.pretext");
282+
if (ptxMarker) {
283+
return true;
284+
} else {
285+
return false;
286+
}
287+
}
277288
// _ processPageState
278289
// -------------------------
279290
function processPageState(completionFlag) {
@@ -285,11 +296,14 @@ function processPageState(completionFlag) {
285296
currentPathname.lastIndexOf("?")
286297
);
287298
}
299+
// Is this a ptx book?
300+
let isPtxBook = isPreTeXt()
288301
var data = {
289302
lastPageUrl: currentPathname,
290303
lastPageScrollLocation: $(window).scrollTop(),
291304
completionFlag: completionFlag,
292305
course: eBookConfig.course,
306+
isPtxBook: isPtxBook,
293307
};
294308
$(document).ajaxError(function (e, jqhxr, settings, exception) {
295309
console.log("Request Failed for " + settings.url);

runestone/parsons/js/parsons.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -491,15 +491,6 @@ export default class Parsons extends RunestoneBase {
491491
//areaHeight += (blocks.length);
492492
}
493493
// + 40 to areaHeight to provide some additional buffer in case any text overflow still happens - Vincent Qiu (September 2020)
494-
this.areaHeight = areaHeight + 40;
495-
$(this.sourceArea).css({
496-
width: this.areaWidth + 2,
497-
height: areaHeight,
498-
});
499-
$(this.answerArea).css({
500-
width: this.options.pixelsPerIndent * indent + this.areaWidth + 2,
501-
height: areaHeight,
502-
});
503494
if (indent > 0 && indent <= 4) {
504495
$(this.answerArea).addClass("answer" + indent);
505496
} else {
@@ -558,6 +549,19 @@ export default class Parsons extends RunestoneBase {
558549
} else {
559550
pairedBins = [];
560551
}
552+
areaHeight += pairedBins.length * 10; // the paired bins take up extra space which can
553+
// cause the blocks to spill out. This
554+
// corrects that by adding a little extra
555+
this.areaHeight = areaHeight + 40;
556+
$(this.sourceArea).css({
557+
width: this.areaWidth + 2,
558+
height: areaHeight,
559+
});
560+
$(this.answerArea).css({
561+
width: this.options.pixelsPerIndent * indent + this.areaWidth + 2,
562+
height: areaHeight,
563+
});
564+
561565
this.pairedBins = pairedBins;
562566
this.pairedDivs = pairedDivs;
563567
if (this.options.numbered != undefined) {

0 commit comments

Comments
 (0)