Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiraux committed Oct 22, 2024
1 parent 262f9fd commit e2200fd
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion inginious/frontend/flask/mongo_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def open_session(self, app, request):

store_id = sid
document = self.store.find_one({'_id': store_id})
if document and document.get('expiration') <= datetime.now(timezone.utc):
if document and document['expiration'].replace(tzinfo=timezone.utc) <= datetime.now(timezone.utc):
# Delete expired session
self.store.delete_one({'_id': store_id})
document = None
Expand Down
1 change: 0 additions & 1 deletion inginious/frontend/lti_grade_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def run(self):
try:
course = self._app.course_factory.get_course(courseid)
task = course.get_task(taskid)
print(self._app.user_manager.get_task_cache(username, courseid, task.get_id()))
grade = self._app.user_manager.get_task_cache(username, courseid, task.get_id())["grade"]
except Exception:
self._logger.error("An exception occurred while getting a course/LTI secret/grade in LTIGradeManager.", exc_info=True)
Expand Down
3 changes: 2 additions & 1 deletion inginious/frontend/pages/lti.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def GET_AUTH(self):
return self.template_helper.render("lti_bind.html", success=False, data=data, error="")

def POST_AUTH(self):
data, error = self._get_lti_session_data_or_error()
data, error = self._get_lti_session_data()
if error:
return error

Expand Down Expand Up @@ -222,6 +222,7 @@ def _find_realname(self, launch_data):
return launch_data["sub"]

class LTILoginPage(INGIniousPage):
@property
def is_lti_page(self):
return True

Expand Down
2 changes: 1 addition & 1 deletion inginious/frontend/submission_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _job_done_callback(self, submissionid, course, task, result, grade, problems

self._plugin_manager.call_hook("submission_done", submission=submission, archive=archive, newsub=newsub)

if course.lti_send_back_grade:
if course.lti_send_back_grade():
for username in submission["username"]:
self._lti_grade_manager.add(username,
submission["courseid"],
Expand Down
3 changes: 0 additions & 3 deletions inginious/frontend/user_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def session_is_lti(self) -> bool:
def _lti_session(self):
""" Returns the LTI session dict. """
assert self.session_is_lti()
print("get session", flask.request.args.get('session_id'), flask.g.get('lti_session_id'))
if 'lti_session' not in flask.g:
if 'session_id' in flask.request.args:
flask.g.lti_session = self._database.lti_sessions.find_one({'session_id': flask.request.args['session_id']})
Expand All @@ -129,7 +128,6 @@ def _lti_session(self):
@staticmethod
def _lti_session_save(app, response):
""" Saves in database the LTI session. This function is a Flask event receiver. """
print("save session", flask.request.args.get('session_id'), flask.g.get('lti_session_id'))
if app.user_manager.session_is_lti():
lti_session_id = flask.request.args.get('session_id', flask.g.get('lti_session_id'))
app.user_manager._database.lti_sessions.find_one_and_update({'session_id': lti_session_id}, {'$set': flask.g.lti_session}, upsert=True)
Expand All @@ -138,7 +136,6 @@ def _lti_session_save(app, response):
@property
def _session(self):
""" Returns the session. """
print(self._flask_session, self._lti_session)
return self._flask_session if not self.session_is_lti() else self._lti_session

def session_logged_in(self):
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"Flask-Mail==0.9.1",
"itsdangerous==2.1.2",
"Jinja2==3.1.3",
"lti==0.9.5",
"PyLTI1p3==2.0.0",
"msgpack==1.0.7",
"natsort==8.4.0",
Expand Down

0 comments on commit e2200fd

Please sign in to comment.