Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Remove unused code related to ngx graph #9628

Merged
merged 9 commits into from
Nov 2, 2024
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ jacocoTestCoverageVerification {
counter = "INSTRUCTION"
value = "COVEREDRATIO"
// TODO: in the future the following value should become higher than 0.92
minimum = 0.894
minimum = 0.892
}
limit {
counter = "CLASS"
Expand Down
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ module.exports = {
coverageThreshold: {
global: {
// TODO: in the future, the following values should increase to at least 90%
statements: 87.52,
branches: 73.62,
functions: 82.12,
lines: 87.57,
statements: 87.46,
branches: 73.56,
functions: 82.04,
lines: 87.52,
},
},
coverageReporters: ['clover', 'json', 'lcov', 'text-summary'],
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import de.tum.cit.aet.artemis.atlas.dto.LearningPathHealthDTO;
import de.tum.cit.aet.artemis.atlas.dto.LearningPathInformationDTO;
import de.tum.cit.aet.artemis.atlas.dto.LearningPathNavigationOverviewDTO;
import de.tum.cit.aet.artemis.atlas.dto.NgxLearningPathDTO;
import de.tum.cit.aet.artemis.atlas.repository.CompetencyProgressRepository;
import de.tum.cit.aet.artemis.atlas.repository.CompetencyRelationRepository;
import de.tum.cit.aet.artemis.atlas.repository.CompetencyRepository;
Expand Down Expand Up @@ -85,8 +84,6 @@ public class LearningPathService {

private final CompetencyRelationRepository competencyRelationRepository;

private final LearningPathNgxService learningPathNgxService;

private final LectureUnitCompletionRepository lectureUnitCompletionRepository;

private final StudentParticipationRepository studentParticipationRepository;
Expand All @@ -95,17 +92,15 @@ public class LearningPathService {

public LearningPathService(UserRepository userRepository, LearningPathRepository learningPathRepository, CompetencyProgressRepository competencyProgressRepository,
LearningPathNavigationService learningPathNavigationService, CourseRepository courseRepository, CompetencyRepository competencyRepository,
CompetencyRelationRepository competencyRelationRepository, LearningPathNgxService learningPathNgxService,
LectureUnitCompletionRepository lectureUnitCompletionRepository, StudentParticipationRepository studentParticipationRepository,
CourseCompetencyRepository courseCompetencyRepository) {
CompetencyRelationRepository competencyRelationRepository, LectureUnitCompletionRepository lectureUnitCompletionRepository,
StudentParticipationRepository studentParticipationRepository, CourseCompetencyRepository courseCompetencyRepository) {
this.userRepository = userRepository;
this.learningPathRepository = learningPathRepository;
this.competencyProgressRepository = competencyProgressRepository;
this.learningPathNavigationService = learningPathNavigationService;
this.courseRepository = courseRepository;
this.competencyRepository = competencyRepository;
this.competencyRelationRepository = competencyRelationRepository;
this.learningPathNgxService = learningPathNgxService;
this.lectureUnitCompletionRepository = lectureUnitCompletionRepository;
this.studentParticipationRepository = studentParticipationRepository;
this.courseCompetencyRepository = courseCompetencyRepository;
Expand Down Expand Up @@ -382,28 +377,6 @@ public LearningPathCompetencyGraphDTO generateLearningPathCompetencyInstructorGr
return new LearningPathCompetencyGraphDTO(progressDTOs, relationDTOs);
}

/**
* Generates Ngx graph representation of the learning path graph.
*
* @param learningPath the learning path for which the Ngx representation should be created
* @return Ngx graph representation of the learning path
* @see NgxLearningPathDTO
*/
public NgxLearningPathDTO generateNgxGraphRepresentation(@NotNull LearningPath learningPath) {
return this.learningPathNgxService.generateNgxGraphRepresentation(learningPath);
}

/**
* Generates Ngx path representation of the learning path.
*
* @param learningPath the learning path for which the Ngx representation should be created
* @return Ngx path representation of the learning path
* @see NgxLearningPathDTO
*/
public NgxLearningPathDTO generateNgxPathRepresentation(@NotNull LearningPath learningPath) {
return this.learningPathNgxService.generateNgxPathRepresentation(learningPath);
}

/**
* Get the navigation overview for a given learning path.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import de.tum.cit.aet.artemis.atlas.dto.LearningPathNavigationObjectDTO;
import de.tum.cit.aet.artemis.atlas.dto.LearningPathNavigationObjectDTO.LearningObjectType;
import de.tum.cit.aet.artemis.atlas.dto.LearningPathNavigationOverviewDTO;
import de.tum.cit.aet.artemis.atlas.dto.NgxLearningPathDTO;
import de.tum.cit.aet.artemis.atlas.repository.LearningPathRepository;
import de.tum.cit.aet.artemis.atlas.service.competency.CompetencyProgressService;
import de.tum.cit.aet.artemis.atlas.service.learningpath.LearningPathNavigationService;
Expand Down Expand Up @@ -218,32 +217,6 @@ public ResponseEntity<LearningPathCompetencyGraphDTO> getLearningPathCompetencyI
return ResponseEntity.ok(learningPathService.generateLearningPathCompetencyInstructorGraph(courseId));
}

/**
* GET learning-path/:learningPathId/graph : Gets the ngx representation of the learning path as a graph.
*
* @param learningPathId the id of the learning path that should be fetched
* @return the ResponseEntity with status 200 (OK) and with body the ngx representation of the learning path
*/
@GetMapping("learning-path/{learningPathId}/graph")
@EnforceAtLeastStudent
public ResponseEntity<NgxLearningPathDTO> getLearningPathNgxGraph(@PathVariable long learningPathId) {
log.debug("REST request to get ngx graph representation of learning path with id: {}", learningPathId);
return getLearningPathNgx(learningPathId, NgxRequestType.GRAPH);
}

/**
* GET learning-path/:learningPathId/path : Gets the ngx representation of the learning path as a sequential path.
*
* @param learningPathId the id of the learning path that should be fetched
* @return the ResponseEntity with status 200 (OK) and with body the ngx representation of the learning path
*/
@GetMapping("learning-path/{learningPathId}/path")
@EnforceAtLeastStudent
public ResponseEntity<NgxLearningPathDTO> getLearningPathNgxPath(@PathVariable long learningPathId) {
log.debug("REST request to get ngx path representation of learning path with id: {}", learningPathId);
return getLearningPathNgx(learningPathId, NgxRequestType.PATH);
}

/**
* GET learning-path/:learningPathId/relative-navigation : Gets the navigation information for the learning path relative to a learning object.
*
Expand Down Expand Up @@ -293,20 +266,6 @@ public ResponseEntity<LearningPathNavigationOverviewDTO> getLearningPathNavigati
return ResponseEntity.ok(learningPathService.getLearningPathNavigationOverview(learningPathId));
}

private ResponseEntity<NgxLearningPathDTO> getLearningPathNgx(@PathVariable long learningPathId, NgxRequestType type) {
LearningPath learningPath = learningPathService.findWithCompetenciesAndReleasedLearningObjectsAndCompletedUsersById(learningPathId);
Course course = courseRepository.findByIdElseThrow(learningPath.getCourse().getId());
courseService.checkLearningPathsEnabledElseThrow(course);

checkLearningPathAccessElseThrow(Optional.of(course), learningPath, Optional.empty());

NgxLearningPathDTO ngxLearningPathDTO = switch (type) {
case GRAPH -> learningPathService.generateNgxGraphRepresentation(learningPath);
case PATH -> learningPathService.generateNgxPathRepresentation(learningPath);
};
return ResponseEntity.ok(ngxLearningPathDTO);
}

/**
* GET courses/:courseId/learning-path/me : Gets the learning path of the current user in the course.
*
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading