Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
22e323c
Update raw templates for Jinja2
runestonetest Dec 15, 2020
723cb34
update endpoint for logBookEvent
bnmnetp Dec 17, 2020
075020a
Update raw templates for Jinja2
runestonetest Dec 15, 2020
dc8fd33
Move timezone offset to fetch
runestonetest May 5, 2021
024b850
Fix: Enable use with SQLite.
bjones1 May 6, 2021
bda4cc3
Merge branch 'bookserver' into bookserver
bnmnetp May 6, 2021
255bc92
Merge pull request #1194 from bjones1/bookserver
bnmnetp May 6, 2021
20355b5
use new url for runlog
runestonetest May 6, 2021
9d1327e
Merge branch 'bookserver' of github.com:RunestoneInteractive/Runeston…
runestonetest May 6, 2021
e10e7e8
Fix: Use consistant naming between ajax and db tables.
bjones1 May 10, 2021
ea93387
update processing for getassessment
runestonetest May 10, 2021
7a99f90
Merge pull request #1197 from bjones1/bookserver
bnmnetp May 11, 2021
166a1a4
Better use of response detail from new server
runestonetest May 12, 2021
627236b
bump esversion
runestonetest May 12, 2021
c2f1c0d
Docs: correct Intersphinx links.
bjones1 May 12, 2021
36daed5
Fix: Provide sensible default values for more fields.
bjones1 May 26, 2021
79373e8
Update raw templates for Jinja2
runestonetest Dec 15, 2020
75a3dfc
update endpoint for logBookEvent
bnmnetp Dec 17, 2020
5c8f9ed
clarify what is provided for course_name
bnmnetp Dec 30, 2020
f1f0d3a
update url for assessment results
bnmnetp Jun 7, 2021
70f6179
update for gethist and runlog
bnmnetp Jun 8, 2021
836f28b
Merge pull request #1205 from bjones1/default_vals
bnmnetp Jun 8, 2021
9b5a74e
make version 6.0.0dev
runestonetest Jun 10, 2021
294c055
Move timezone offset to fetch
runestonetest May 5, 2021
bcb3eca
Fix: Enable use with SQLite.
bjones1 May 6, 2021
52e3dfc
Fix: Update for newer feedback format from the bookserver.
bjones1 May 26, 2021
1716eba
Fix: Update to newer feedback format from the server for lp questions.
bjones1 May 29, 2021
63b712e
update processing for getassessment
runestonetest May 10, 2021
cef6644
Better use of response detail from new server
runestonetest May 12, 2021
79eb08b
bump esversion
runestonetest May 12, 2021
29bad63
Docs: correct Intersphinx links.
bjones1 May 12, 2021
1c7be0d
Fix: Provide sensible default values for more fields.
bjones1 May 26, 2021
7e1ba8d
make version 6.0.0dev
runestonetest Jun 10, 2021
52e52eb
Fix: Log data to answer, instead of act field.
bjones1 May 31, 2021
cf8acec
getting synced with origin
bnmnetp Jun 13, 2021
1a4c916
Update raw templates for Jinja2
runestonetest Dec 15, 2020
a27183e
update endpoint for logBookEvent
bnmnetp Dec 17, 2020
334b1ff
clarify what is provided for course_name
bnmnetp Dec 30, 2020
ea9d16e
update url for assessment results
bnmnetp Jun 7, 2021
2a85455
update for gethist and runlog
bnmnetp Jun 8, 2021
db19859
Move timezone offset to fetch
runestonetest May 5, 2021
36304c8
Fix: Enable use with SQLite.
bjones1 May 6, 2021
bd6d0fd
update processing for getassessment
runestonetest May 10, 2021
39298d2
Better use of response detail from new server
runestonetest May 12, 2021
8df3a88
bump esversion
runestonetest May 12, 2021
18bf355
Docs: correct Intersphinx links.
bjones1 May 12, 2021
c153617
Fix: Provide sensible default values for more fields.
bjones1 May 26, 2021
87c8cff
make version 6.0.0dev
runestonetest Jun 10, 2021
7aa5019
Move timezone offset to fetch
runestonetest May 5, 2021
10055dd
Better use of response detail from new server
runestonetest May 12, 2021
4057bfe
rebaseing
bnmnetp Jun 13, 2021
9df9f8f
add ref label
bnmnetp Jun 15, 2021
5bc9de5
add bookfuncs to every page
bnmnetp Jun 16, 2021
3fbc9ee
use new endpoint for decorating toc
bnmnetp Jun 16, 2021
3cf96c7
fix updatelastpage
bnmnetp Jun 17, 2021
56856b2
get detail add refrence links
bnmnetp Jun 17, 2021
ba5b95e
Merge pull request #1207 from bjones1/fixes
bnmnetp Jun 21, 2021
ff939ea
ensure we update page status
bnmnetp Jun 21, 2021
90bfe1a
Merge branch 'bookserver' of github.com:RunestoneInteractive/Runeston…
bnmnetp Jun 23, 2021
fd82dc4
Fix: Match name sent to server with table name in db.
bjones1 Jun 25, 2021
45228d4
more bookserver updates
bnmnetp Jul 12, 2021
51b4de3
Polls are restored correctly
bnmnetp Jul 12, 2021
3c0f505
update fitb for bookserver
bnmnetp Jul 13, 2021
c1330cf
update api endpoints for bookserver
bnmnetp Jul 15, 2021
72ecdb8
Merge pull request #1213 from bjones1/fix_dnd
bnmnetp Jul 19, 2021
5b85683
Add: Dynamic problems for fitb questions.
bjones1 Jul 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"allVisualizers",
"console"
],
"esversion": 6,
"esversion": 8,
"quotmark": true,
"strict": "implied",
"sub": true,
Expand Down
2 changes: 2 additions & 0 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Runestone Components
********************
This site documents the working of the Runestone Components. See the `Runestone Interactive Overview <https://runestone.academy/runestone/books/published/overview/overview.html>`_ or the `Runestone instructor's guide <https://runestone.academy/runestone/static/instructorguide/index.html>`_.

Demo linking to the Runestone Server docs: :ref:`assignments/grades_report endpoint`.


Getting started
===============
Expand Down
36 changes: 21 additions & 15 deletions runestone/activecode/js/activecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ export class ActiveCode extends RunestoneBase {
if (!didAgree) {
didAgree = confirm(
"Pair Programming should only be used with the consent of your instructor." +
"Your partner must be a registered member of the class and have agreed to pair with you." +
"By clicking OK you certify that both of these conditions have been met."
"Your partner must be a registered member of the class and have agreed to pair with you." +
"By clicking OK you certify that both of these conditions have been met."
);
if (didAgree) {
localStorage.setItem("partnerAgree", "true");
Expand Down Expand Up @@ -514,13 +514,13 @@ export class ActiveCode extends RunestoneBase {
$(butt).attr(
"href",
"http://" +
chatcodesServer +
"/new?" +
$.param({
topic: window.location.host + "-" + this.divid,
code: this.editor.getValue(),
lang: "Python",
})
chatcodesServer +
"/new?" +
$.param({
topic: window.location.host + "-" + this.divid,
code: this.editor.getValue(),
lang: "Python",
})
);
this.chatButton = butt;
chatBar.appendChild(butt);
Expand Down Expand Up @@ -554,6 +554,8 @@ export class ActiveCode extends RunestoneBase {
$(this.runButton).text($.i18n("msg_activecode_save_run"));
}

// _`addHistoryScrubber`
// ---------------------
// Activecode -- If the code has not changed wrt the scrubber position value then don't save the code or reposition the scrubber
// -- still call runlog, but add a parameter to not save the code
// add an initial load history button
Expand All @@ -574,14 +576,18 @@ export class ActiveCode extends RunestoneBase {
// If this is timed and already taken we should restore history info
this.renderScrubber();
} else {
let request = new Request(eBookConfig.ajaxURL + "gethist.json", {
let request = new Request("/assessment/gethist", {
method: "POST",
headers: this.jsonHeaders,
body: JSON.stringify(reqData),
});
try {
response = await fetch(request);
let data = await response.json();
if (!response.ok) {
throw new Error(`Failed to get the history data: ${data.detail}`);
}
data = data.detail;
if (data.history !== undefined) {
this.history = this.history.concat(data.history);
for (let t in data.timestamps) {
Expand All @@ -591,7 +597,7 @@ export class ActiveCode extends RunestoneBase {
}
}
} catch (e) {
console.log("unable to fetch history");
console.log(`unable to fetch history: ${e}`);
}
this.renderScrubber(pos_last);
}
Expand Down Expand Up @@ -907,7 +913,7 @@ export class ActiveCode extends RunestoneBase {
});
}

toggleEditorVisibility() {}
toggleEditorVisibility() { }

addErrorMessage(err) {
// Add the error message
Expand Down Expand Up @@ -1045,7 +1051,7 @@ Yet another is that there is an internal error. The internal error message is:
var xl = eval(x);
xl = xl.map(pyStr);
x = xl.join(" ");
} catch (err) {}
} catch (err) { }
}
}
$(this.output).css("visibility", "visible");
Expand Down Expand Up @@ -1149,7 +1155,7 @@ Yet another is that there is an internal error. The internal error message is:
if (
this.historyScrubber &&
this.history[$(this.historyScrubber).slider("value")] !=
this.editor.getValue()
this.editor.getValue()
) {
saveCode = "True";
this.history.push(this.editor.getValue());
Expand Down Expand Up @@ -1186,7 +1192,7 @@ Yet another is that there is an internal error. The internal error message is:
this.logRunEvent({
div_id: this.divid,
code: this.editor.getValue(),
lang: this.language,
language: this.language,
errinfo: this.errinfo,
to_save: this.saveCode,
prefix: this.pretext,
Expand Down
7 changes: 3 additions & 4 deletions runestone/activecode/js/activecode_sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export default class SQLActiveCode extends ActiveCode {
this.logRunEvent({
div_id: this.divid,
code: this.editor.getValue(),
lang: this.language,
language: this.language,
errinfo: this.results[this.results.length - 1].status,
to_save: this.saveCode,
prefix: this.pretext,
Expand Down Expand Up @@ -292,9 +292,8 @@ export default class SQLActiveCode extends ActiveCode {
}
let pct = (100 * this.passed) / (this.passed + this.failed);
pct = pct.toLocaleString(undefined, { maximumFractionDigits: 2 });
result += `You passed ${this.passed} out of ${
this.passed + this.failed
} tests for ${pct}%`;
result += `You passed ${this.passed} out of ${this.passed + this.failed
} tests for ${pct}%`;
this.unit_results = `percent:${pct}:passed:${this.passed}:failed:${this.failed}`;
return result;
}
Expand Down
4 changes: 3 additions & 1 deletion runestone/clickableArea/js/clickable.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,11 @@ export default class ClickableArea extends RunestoneBase {
}

logCurrentAnswer() {
const answer = this.givenIndexArray.join(";");
this.logBookEvent({
event: "clickableArea",
act: this.givenIndexArray.join(";"),
answer: answer,
act: answer,
div_id: this.divid,
correct: this.correct ? "T" : "F",
});
Expand Down
2 changes: 1 addition & 1 deletion runestone/common/css/runestone-custom-sphinx-bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ ul.dropdown-menu.globaltoc {


/* Style lp textareas. */
textarea#lp-result {
textarea.lp-result {
width: 100%;
height: 10em;
font-family: monospace;
Expand Down
27 changes: 20 additions & 7 deletions runestone/common/js/bookfuncs.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ function addReadingList() {
});
} else {
l = $("<div />", {
text:
"This page is not part of the last reading assignment you visited.",
text: "This page is not part of the last reading assignment you visited.",
});
}
$("#main-content").append(l);
Expand Down Expand Up @@ -206,12 +205,26 @@ class PageProgressBar {

export var pageProgressTracker = {};

function handlePageSetup() {
async function handlePageSetup() {
var mess;
if (eBookConfig.useRunestoneServices) {
jQuery.get(eBookConfig.ajaxURL + "set_tz_offset", {
timezoneoffset: new Date().getTimezoneOffset() / 60,
});
let headers = new Headers({
"Content-type": "application/json; charset=utf-8",
Accept: "application/json",
});
let data = { timezoneoffset: new Date().getTimezoneOffset() / 60 };
let request = new Request("/logger/set_tz_offset", {
method: "POST",
body: JSON.stringify(data),
headers: headers,
});
try {
let response = await fetch(request);
if (!response.ok) {
console.error(`Failed to set timezone! ${response.statusText}`);
}
data = await response.json();
} catch (e) {
console.error(`Error setting timezone ${e}`);
}

if (eBookConfig.isLoggedIn) {
Expand Down
63 changes: 35 additions & 28 deletions runestone/common/js/runestonebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import { pageProgressTracker } from "./bookfuncs.js";

export default class RunestoneBase {
constructor(opts) {
this.component_ready_promise = new Promise(resolve => this._component_ready_resolve_fn = resolve)
this.component_ready_promise = new Promise(
(resolve) => (this._component_ready_resolve_fn = resolve)
);
this.optional = false;
if (opts) {
this.sid = opts.sid;
Expand Down Expand Up @@ -57,7 +59,7 @@ export default class RunestoneBase {
// is to look for doAssignment in the URL and then grab
// the assignment name from the heading.
if (location.href.indexOf("doAssignment") >= 0) {
this.timedWrapper = $("h1#assignment_name").text()
this.timedWrapper = $("h1#assignment_name").text();
} else {
this.timedWrapper = null;
}
Expand All @@ -72,37 +74,40 @@ export default class RunestoneBase {
});
}

// .. _logBookEvent:
//
// logBookEvent
// ------------
// _`logBookEvent`
//----------------
// This function sends the provided ``eventInfo`` to the `hsblog endpoint` of the server. Awaiting this function returns either ``undefined`` (if Runestone services are not available) or the data returned by the server as a JavaScript object (already JSON-decoded).
async logBookEvent(eventInfo) {
if (this.graderactive) {
return;
}
let post_return;
eventInfo.course = eBookConfig.course;
eventInfo.course_name = eBookConfig.course;
eventInfo.clientLoginStatus = eBookConfig.isLoggedIn;
eventInfo.timezoneoffset = new Date().getTimezoneOffset() / 60;
if (this.percent) {
eventInfo.percent = this.percent;
}
if (eBookConfig.useRunestoneServices && eBookConfig.logLevel > 0) {
let request = new Request(eBookConfig.ajaxURL + "hsblog", {
let request = new Request("/logger/bookevent", {
method: "POST",
headers: this.jsonHeaders,
body: JSON.stringify(eventInfo),
});
try {
let response = await fetch(request);
if (!response.ok) {
throw new Error("Failed to save the log entry");
let detail = await response.json();
console.error(detail);
throw new Error(`Failed to save the log entry ${detail}`);
} else {
post_return = response.json();
}
post_return = response.json();
} catch (e) {
if (this.isTimed) {
alert(`Error: Your action was not saved! The error was ${e}`);
alert(
`Error: Your action was not saved! The error was ${e}`
);
}
console.log(`Error: ${e}`);
}
Expand All @@ -120,10 +125,8 @@ export default class RunestoneBase {
return post_return;
}

// .. _logRunEvent:
//
// logRunEvent
// -----------
// -`logRunEvent`
//---------------
// This function sends the provided ``eventInfo`` to the `runlog endpoint`. When awaited, this function returns the data (decoded from JSON) the server sent back.
async logRunEvent(eventInfo) {
let post_promise = "done";
Expand All @@ -137,7 +140,7 @@ export default class RunestoneBase {
eventInfo.save_code = "True";
}
if (eBookConfig.useRunestoneServices && eBookConfig.logLevel > 0) {
let request = new Request(eBookConfig.ajaxURL + "runlog.json", {
let request = new Request("/logger/runlog", {
method: "POST",
headers: this.jsonHeaders,
body: JSON.stringify(eventInfo),
Expand Down Expand Up @@ -192,19 +195,23 @@ export default class RunestoneBase {
data.sid = this.sid;
}
if (!eBookConfig.practice_mode && this.assessmentTaken) {
let request = new Request(
eBookConfig.ajaxURL + "getAssessResults",
{
method: "POST",
body: JSON.stringify(data),
headers: this.jsonHeaders,
}
);
let request = new Request("/assessment/results", {
method: "POST",
body: JSON.stringify(data),
headers: this.jsonHeaders,
});
try {
let response = await fetch(request);
data = await response.json();
this.repopulateFromStorage(data);
this.csresolver("server");
if (response.ok) {
data = await response.json();
data = data.detail;
this.repopulateFromStorage(data);
this.csresolver("server");
} else {
alert(
`HTTP Error getting results: ${response.statusText}`
);
}
} catch (err) {
try {
this.checkLocalStorage();
Expand Down Expand Up @@ -252,7 +259,7 @@ export default class RunestoneBase {
*/
repopulateFromStorage(data) {
// decide whether to use the server's answer (if there is one) or to load from storage
if (data !== null && this.shouldUseServer(data)) {
if (data !== null && data !== "no data" && this.shouldUseServer(data)) {
this.restoreAnswers(data);
this.setLocalStorage(data);
} else {
Expand Down
Loading