Skip to content

Commit

Permalink
[course_factory] fix bug/typo regarding refactoring from course_facto…
Browse files Browse the repository at this point in the history
…ry to taskset_factory (#1026)
  • Loading branch information
AlexandreDoneux authored Feb 11, 2025
1 parent 54a65c9 commit 05be7ce
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions inginious/frontend/pages/api/courses.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def API_GET(self, courseid): # pylint: disable=arguments-differ
output = []

if courseid is None:
courses = self.taskset_factory.get_all_courses()
courses = self.course_factory.get_all_courses()
else:
try:
courses = {courseid: self.taskset_factory.get_course(courseid)}
courses = {courseid: self.course_factory.get_course(courseid)}
except:
raise APINotFound("Course not found")

Expand Down
6 changes: 3 additions & 3 deletions inginious/frontend/pages/api/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
from inginious.frontend.pages.api._api_page import APIAuthenticatedPage, APINotFound, APIForbidden, APIInvalidArguments, APIError


def _get_submissions(taskset_factory, submission_manager, user_manager, translations, courseid, taskid, with_input, submissionid=None):
def _get_submissions(course_factory, submission_manager, user_manager, translations, courseid, taskid, with_input, submissionid=None):
"""
Helper for the GET methods of the two following classes
"""

try:
course = taskset_factory.get_course(courseid)
course = course_factory.get_course(courseid)
except:
raise APINotFound("Course not found")

Expand Down Expand Up @@ -168,7 +168,7 @@ def API_POST(self, courseid, taskid): # pylint: disable=arguments-differ
"""

try:
course = self.taskset_factory.get_course(courseid)
course = self.course_factory.get_course(courseid)
except:
raise APINotFound("Course not found")

Expand Down
2 changes: 1 addition & 1 deletion inginious/frontend/pages/api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def API_GET(self, courseid, taskid): # pylint: disable=arguments-differ
"""

try:
course = self.taskset_factory.get_course(courseid)
course = self.course_factory.get_course(courseid)
except:
raise APINotFound("Course not found")

Expand Down
2 changes: 1 addition & 1 deletion inginious/frontend/pages/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GroupPage(INGIniousAuthPage):
def GET_AUTH(self, courseid): # pylint: disable=arguments-differ
""" GET request """

course = self.taskset_factory.get_course(courseid)
course = self.course_factory.get_course(courseid)
username = self.user_manager.session_username()

error = False
Expand Down
3 changes: 2 additions & 1 deletion inginious/frontend/pages/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from inginious.frontend.parsable_text import ParsableText
from pymongo.database import Database

from inginious.frontend.course_factory import CourseFactory
from inginious.frontend.taskset_factory import TasksetFactory
from inginious.frontend.task_factory import TaskFactory
from inginious.frontend.lti_outcome_manager import LTIOutcomeManager
Expand Down Expand Up @@ -76,7 +77,7 @@ def taskset_factory(self) -> TasksetFactory:
return self.app.taskset_factory

@property
def course_factory(self) -> TaskFactory:
def course_factory(self) -> CourseFactory:
""" Returns the task factory singleton """
return self.app.course_factory

Expand Down
6 changes: 3 additions & 3 deletions inginious/frontend/plugins/contests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class ContestScoreboard(INGIniousAuthPage):
""" Displays the scoreboard of the contest """

def GET_AUTH(self, courseid): # pylint: disable=arguments-differ
course = self.taskset_factory.get_course(courseid)
course = self.course_factory.get_course(courseid)
task_dispenser = course.get_task_dispenser()
if not task_dispenser.get_id() == Contest.get_id():
raise NotFound()
Expand Down Expand Up @@ -191,9 +191,9 @@ class ContestAdmin(INGIniousAdminPage):

def save_contest_data(self, course, contest_data):
""" Saves updated contest data for the course """
course_content = self.taskset_factory.get_course_descriptor_content(course.get_id())
course_content = self.course_factory.get_course_descriptor_content(course.get_id())
course_content["dispenser_data"]["contest_settings"] = contest_data
self.taskset_factory.update_course_descriptor_content(course.get_id(), course_content)
self.course_factory.update_course_descriptor_content(course.get_id(), course_content)

def GET_AUTH(self, courseid): # pylint: disable=arguments-differ
""" GET request: simply display the form """
Expand Down
4 changes: 2 additions & 2 deletions inginious/frontend/plugins/simple_grader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from inginious.frontend.pages.utils import INGIniousPage


def init(plugin_manager, taskset_factory, client, config):
def init(plugin_manager, course_factory, client, config):
"""
Init the external grader plugin. This simple grader allows only anonymous requests, and submissions are not stored in database.
Expand All @@ -32,7 +32,7 @@ def init(plugin_manager, taskset_factory, client, config):
Different types of request are available : see documentation
"""
courseid = config.get('courseid', 'external')
course = taskset_factory.get_course(courseid)
course = course_factory.get_course(courseid)
page_pattern = config.get('page_pattern', '/external')
return_fields = re.compile(config.get('return_fields', '^(result|text|problems)$'))

Expand Down
2 changes: 1 addition & 1 deletion inginious/frontend/plugins/upcoming_tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def time_planner_conversion(self, string_time_planner):
def page(self, time_planner):
""" General main method called for GET and POST """
username = self.user_manager.session_username()
all_courses = self.taskset_factory.get_all_courses()
all_courses = self.course_factory.get_all_courses()
time_planner = self.time_planner_conversion(time_planner)

# Get the courses id
Expand Down

0 comments on commit 05be7ce

Please sign in to comment.