Verified Commit 21476bc2 authored by Peter Stanko's avatar Peter Stanko
Browse files

Extensive logging for service layer

parent 08ae94a4
Pipeline #17458 passed with stage
in 9 minutes and 3 seconds
......@@ -35,7 +35,7 @@ class CourseService(GeneralService):
course = Course()
self._entity = course
self._set_data(entity=course, **data)
log.debug(f"[CREATE] Course {course.log_name} by {self.client_name}: {course}")"[CREATE] Course {course.log_name} by {self.client_name}: {course.log_name}")
return course
def copy_course(self, target: Course, config: dict) -> Course:
......@@ -48,6 +48,7 @@ class CourseService(GeneralService):
Returns(Course): Copied course instance (target)
""""[COPY] Copy course from {self.course.log_name} -> {target.log_name}: {config}")
if config.get('roles'):
for role in self.course.roles:
self._rest_service.roles(role).copy_role(target, with_clients=config['roles'])
......@@ -75,7 +76,7 @@ class CourseService(GeneralService):
self.course.notes_access_token = token
self.write_entity(self.course)"[UPDATE] Notes access token {self.course.log_name} "
f"by {self.client_name}: {token}")
f"by {self.client_name}")
return self.course
def get_clients_filtered(self, groups: List[str], roles: List[str], client_type=None) -> List[User]:
......@@ -45,11 +45,14 @@ class ProjectService(GeneralService):
Returns(Project): Copied project
new_name = get_new_name(self.project, target)
new_project = Project(target, codename=new_name)
new_project.description = self.project.description =
new_project.set_config(**vars(self.project.config))"[COPY] Project from {self.project.log_name} by"
f" {self.client_name}: {new_project.log_name}")
return new_project
def can_create_submission(self, user: User) -> bool:
......@@ -189,6 +192,7 @@ class ProjectService(GeneralService):
def update_project_test_files(self):
""" Sends a request to Storage to update the project's test_files to the newest version.
""""[SERVICE] Updating project files for {self.project.log_name}")
def calculate_wait_time(self, user: User) -> datetime.datetime:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment