Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions bases/rsptx/book_server_api/routers/books.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ async def serve_page(
context = dict(
request=request,
course_name=course_name,
term_start_date=course_row.term_start_date.isoformat(),
base_course=course_row.base_course,
user_id=user.username if user else "",
# _`root_path`: The server is mounted in a different location depending on how it's run (directly from gunicorn/uvicorn or under the ``/ns`` prefix using nginx). Tell the JS what prefix to use for Ajax requests. See also `setting root_path <setting root_path>` and the `FastAPI docs <https://fastapi.tiangolo.com/advanced/behind-a-proxy/>`_. This is then used in the ``eBookConfig`` of :doc:`runestone/common/project_template/_templates/plugin_layouts/sphinx_bootstrap/layout.html`.
Expand Down
2 changes: 2 additions & 0 deletions bases/rsptx/book_server_api/routers/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def sort_key(assignment):
"assignment_list": assignments,
"stats": stats,
"course": course,
"is_old_course": course.term_start_date
< (datetime.datetime.now() - datetime.timedelta(weeks=52)).date(),
"user": user,
"request": request,
"institution": course.institution,
Expand Down
12 changes: 6 additions & 6 deletions bases/rsptx/interactives/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bases/rsptx/interactives/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"handsontable": "7.2.2",
"jexcel": "^3.9.1",
"jquery-ui": "1.10.4",
"micro-parsons": "https://github.com/RunestoneInteractive/micro-parsons-element/releases/download/v0.1.7/micro-parsons-0.1.7.tgz",
"micro-parsons": "https://github.com/RunestoneInteractive/micro-parsons-element/releases/download/v0.2.0/micro-parsons-0.2.0.tgz",
"select2": "^4.1.0-rc.0",
"sql.js": "1.5.0",
"vega-embed": "3.14.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,21 @@ export default class ClickableArea extends RunestoneBase {
var ex = localStorage.getItem(this.localStorageKey());
if (ex !== null) {
this.hasStoredAnswers = true;
let error = false;
try {
storageObj = JSON.parse(ex);
this.clickedIndexArray = storageObj.answer.split(";");
} catch (err) {
// error while parsing; likely due to bad value stored in storage
console.log(err.message);
console.log(`Error parsing stored ClickableArea data for ${this.divid}: ${err.message}`);
error = true;
}
if (error || storageObj.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(this.localStorageKey());
this.hasStoredAnswers = false;
this.restoreAnswers({});
return;
}
this.clickedIndexArray = storageObj.answer.split(";");
if (this.useRunestoneServices) {
// log answer to server
this.givenIndexArray = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@
eBookConfig.host = '';
eBookConfig.app = eBookConfig.host + '/runestone';
eBookConfig.course = '{{ course_name }}';
eBookConfig.termStartDate = '{{ term_start_date }}';
eBookConfig.basecourse = '{{ base_course }}';
eBookConfig.isLoggedIn = {{ is_logged_in}};
eBookConfig.email = '{{ user_email }}';
Expand All @@ -309,6 +310,7 @@
eBookConfig.host = '{{course_url}}' || 'http://127.0.0.1:8000';
eBookConfig.app = eBookConfig.host+'/{{appname}}';
eBookConfig.course = '{{course_id}}';
eBookConfig.termStartDate = '{{ term_start_date }}';
eBookConfig.basecourse = '{{ basecourse }}';
eBookConfig.isLoggedIn = false;
eBookConfig.enableCompareMe = eBookConfig.useRunestoneServices;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,19 +700,24 @@ export default class DragNDrop extends RunestoneBase {
var ex = localStorage.getItem(this.localStorageKey());
if (ex !== null) {
this.hasStoredDropzones = true;
let error = false;
try {
storedObj = JSON.parse(ex);
this.minheight = storedObj.min_height;
this.dragwidth = storedObj.drag_width;
this.dropwidth = storedObj.drop_width;
} catch (err) {
// error while parsing; likely due to bad value stored in storage
console.log(err.message);
console.log(`Error parsing stored DragNDrop data for ${this.divid}: ${err}`);
error = true;
}
if (error || storedObj.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(this.localStorageKey());
this.hasStoredDropzones = false;
this.finishSettingUp();
return;
}
localStorage.removeItem(this.localStorageKey());
this.answerState = storedObj.answer;
if (this.useRunestoneServices) {
// store answer in database
Expand Down
6 changes: 5 additions & 1 deletion bases/rsptx/interactives/runestone/fitb/js/fitb.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,15 @@ export default class FITB extends RunestoneBase {
if (len > 0) {
var ex = localStorage.getItem(this.localStorageKey());
if (ex !== null) {
let error = false;
try {
storedData = JSON.parse(ex);
} catch (err) {
// error while parsing; likely due to bad value stored in storage
console.assert(false, err.message);
console.log(`Error parsing stored FITB data for ${this.divid}: ${err.message}`);
error = true;
}
if (error || storedData.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(this.localStorageKey());
return;
}
Expand Down
8 changes: 6 additions & 2 deletions bases/rsptx/interactives/runestone/hparsons/js/hparsons.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ export default class HParsons extends RunestoneBase {
return;
}
let localData = this.localData();
// Guard against no timestamp as it was only added 3/24/2026
if (localData.timestamp && localData.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(this.storageId);
return;
}
if (localData.answerIndices && this.hparsonsInput.restoreAnswerByIndices) {
this.hparsonsInput.restoreAnswerByIndices(localData.answerIndices.map(Number));
} else if (localData.answer) {
Expand All @@ -299,7 +304,6 @@ export default class HParsons extends RunestoneBase {
setLocalStorage(data) {
let currentState = {};
if (data == undefined) {

if (this.isBlockGrading) {
const answerIndices = this.hparsonsInput.getBlockIndices();
currentState = { answerIndices: answerIndices };
Expand All @@ -308,7 +312,7 @@ export default class HParsons extends RunestoneBase {
const userAnswer = this.hparsonsInput.getParsonsTextArray();
currentState = { answer: userAnswer };
}

currentState.timestamp = new Date();
} else {
currentState = data;
}
Expand Down
6 changes: 5 additions & 1 deletion bases/rsptx/interactives/runestone/lp/js/lp.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,15 @@ class LP extends RunestoneBase {
var key = this.localStorageKey();
var ex = localStorage.getItem(key);
if (ex !== null) {
let error = false;
try {
storedData = JSON.parse(ex);
} catch (err) {
// error while parsing; likely due to bad value stored in storage
console.log(err.message);
console.log(`Error parsing stored LP data for ${this.divid}: ${err.message}`);
error = true;
}
if (error || storedData.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(key);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ export class MatchingProblem extends RunestoneBase {
const data = localStorage.getItem(this.divid);
if (data) {
const parsedData = JSON.parse(data);
if (parsedData.timestamp && parsedData.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(this.divid);
return;
}
this.connections = parsedData.connections.map(conn => ({
fromBox: this.allBoxes.find(box => box.dataset.id === conn.from),
toBox: this.allBoxes.find(box => box.dataset.id === conn.to)
Expand All @@ -184,6 +188,7 @@ export class MatchingProblem extends RunestoneBase {
}
}
setLocalStorage() {
const timeStamp = new Date();
const data = {
connections: this.connections.map(conn => ({
from: conn.fromBox.dataset.id,
Expand All @@ -192,7 +197,8 @@ export class MatchingProblem extends RunestoneBase {
score: this.scorePercent,
correctCount: this.correctCount,
incorrectCount: this.incorrectCount,
missingCount: this.missingCount
missingCount: this.missingCount,
timestamp: timeStamp
};
localStorage.setItem(this.divid, JSON.stringify(data));
}
Expand Down
6 changes: 5 additions & 1 deletion bases/rsptx/interactives/runestone/mchoice/js/mchoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,17 @@ export default class MultipleChoice extends RunestoneBase {
var len = localStorage.length;
if (len > 0) {
var ex = localStorage.getItem(this.localStorageKey());
let error = false;
if (ex !== null) {
try {
storedData = JSON.parse(ex);
answers = storedData.answer.split(",");
} catch (err) {
// error while parsing; likely due to bad value stored in storage
console.log(err.message);
console.log(`Error parsing stored mchoice data for ${this.divid}: ${err.message}`);
error = true;
}
if (error || storedData.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(this.localStorageKey());
return;
}
Expand Down
7 changes: 6 additions & 1 deletion bases/rsptx/interactives/runestone/parsons/js/parsons.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,12 @@ export default class Parsons extends RunestoneBase {
if (this.graderactive) {
return;
}
this.loadData(this.localData());
const localData = this.localData();
if (localData.timestamp && localData.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(this.storageId);
localData= {};
}
this.loadData(localData);
}
// RunestoneBase: Set the state of the problem in local storage
setLocalStorage(data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,16 @@ export default class ShortAnswer extends RunestoneBase {
if (len > 0) {
var ex = localStorage.getItem(this.localStorageKey());
if (ex !== null) {
let error = false;
try {
var storedData = JSON.parse(ex);
answer = storedData.answer;
} catch (err) {
// error while parsing; likely due to bad value stored in storage
console.log(err.message);
console.log(`Error parsing stored shortanswer data for ${this.divid}: ${err.message}`);
error = true;
}
if (error || storedData.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(this.localStorageKey());
return;
}
Expand Down
12 changes: 9 additions & 3 deletions bases/rsptx/interactives/runestone/timed/js/timed.js
Original file line number Diff line number Diff line change
Expand Up @@ -1193,13 +1193,19 @@ export default class Timed extends RunestoneBase {
this.taken = 1;
var tmpArr;
if (data === "") {
let error = false;
let storageObj;
try {
tmpArr = JSON.parse(
storageObj = JSON.parse(
localStorage.getItem(this.localStorageKey())
).answer;
);
tmpArr = storageObj.answer;
} catch (err) {
// error while parsing; likely due to bad value stored in storage
console.log(err.message);
console.log(`Error parsing stored Timed data for ${this.divid}: ${err.message}`);
error = true;
}
if (error || storageObj.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(this.localStorageKey());
this.taken = 0;
return;
Expand Down
6 changes: 5 additions & 1 deletion bases/rsptx/interactives/runestone/webwork/js/webwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class WebWork extends RunestoneBase {
var ex = localStorage.getItem(this.localStorageKey());

if (ex !== null) {
let error = false;
try {
storedData = JSON.parse(ex);
// Save the answers so that when the question is activated we can restore.
Expand All @@ -63,7 +64,10 @@ class WebWork extends RunestoneBase {
this.decorateStatus();
} catch (err) {
// error while parsing; likely due to bad value stored in storage
console.log(err.message);
console.log(`Error parsing stored WebWork data for ${this.divid}: ${err.message}`);
error = true;
}
if (error || storedData.timestamp < eBookConfig.termStartDate) {
localStorage.removeItem(this.localStorageKey());
return;
}
Expand Down
Loading
Loading