Skip to content

Commit

Permalink
Merge branch 'develop' into chore/development/use-directive-for-progr…
Browse files Browse the repository at this point in the history
…amming-repository-buttons-details
  • Loading branch information
florian-glombik authored Aug 11, 2024
2 parents 81d8607 + 24f225d commit 95c02d2
Show file tree
Hide file tree
Showing 281 changed files with 8,399 additions and 5,877 deletions.
932 changes: 407 additions & 525 deletions package-lock.json

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
"node_modules"
],
"dependencies": {
"@angular/animations": "18.1.3",
"@angular/cdk": "18.1.3",
"@angular/common": "18.1.3",
"@angular/compiler": "18.1.3",
"@angular/core": "18.1.3",
"@angular/forms": "18.1.3",
"@angular/localize": "18.1.3",
"@angular/material": "18.1.3",
"@angular/platform-browser-dynamic": "18.1.3",
"@angular/platform-browser": "18.1.3",
"@angular/router": "18.1.3",
"@angular/service-worker": "18.1.3",
"@angular/animations": "18.1.4",
"@angular/cdk": "18.1.4",
"@angular/common": "18.1.4",
"@angular/compiler": "18.1.4",
"@angular/core": "18.1.4",
"@angular/forms": "18.1.4",
"@angular/localize": "18.1.4",
"@angular/material": "18.1.4",
"@angular/platform-browser-dynamic": "18.1.4",
"@angular/platform-browser": "18.1.4",
"@angular/router": "18.1.4",
"@angular/service-worker": "18.1.4",
"@ctrl/ngx-emoji-mart": "9.2.0",
"@danielmoncada/angular-datetime-picker": "18.0.0",
"@fingerprintjs/fingerprintjs": "4.4.3",
Expand All @@ -37,15 +37,15 @@
"@ng-bootstrap/ng-bootstrap": "17.0.0",
"@ngx-translate/core": "15.0.0",
"@ngx-translate/http-loader": "8.0.0",
"@sentry/angular": "8.22.0",
"@sentry/angular": "8.24.0",
"@swimlane/ngx-charts": "20.5.0",
"@swimlane/ngx-graph": "8.4.0",
"@vscode/codicons": "0.0.36",
"ace-builds": "1.35.4",
"bootstrap": "5.3.3",
"brace": "0.11.1",
"compare-versions": "6.1.1",
"core-js": "3.37.1",
"core-js": "3.38.0",
"crypto-js": "4.2.0",
"dayjs": "1.11.12",
"diff-match-patch-typescript": "1.0.8",
Expand All @@ -64,7 +64,7 @@
"ngx-infinite-scroll": "18.0.0",
"ngx-webstorage": "18.0.0",
"papaparse": "5.4.1",
"posthog-js": "1.154.2",
"posthog-js": "1.154.5",
"rxjs": "7.8.1",
"showdown": "2.1.0",
"showdown-highlight": "3.1.0",
Expand All @@ -78,7 +78,7 @@
"uuid": "10.0.0",
"webstomp-client": "1.2.6",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
"zone.js": "0.14.8"
"zone.js": "0.14.10"
},
"overrides": {
"@swimlane/ngx-graph": {
Expand Down Expand Up @@ -118,16 +118,16 @@
},
"devDependencies": {
"@angular-builders/jest": "18.0.0",
"@angular-devkit/build-angular": "18.1.3",
"@angular-devkit/build-angular": "18.1.4",
"@angular-eslint/builder": "18.2.0",
"@angular-eslint/eslint-plugin": "18.2.0",
"@angular-eslint/eslint-plugin-template": "18.2.0",
"@angular-eslint/schematics": "18.2.0",
"@angular-eslint/template-parser": "18.2.0",
"@angular/cli": "18.1.3",
"@angular/compiler-cli": "18.1.3",
"@angular/language-service": "18.1.3",
"@sentry/types": "8.22.0",
"@angular/cli": "18.1.4",
"@angular/compiler-cli": "18.1.4",
"@angular/language-service": "18.1.4",
"@sentry/types": "8.24.0",
"@types/crypto-js": "4.2.2",
"@types/d3-shape": "3.1.6",
"@types/dompurify": "3.0.5",
Expand All @@ -139,12 +139,12 @@
"@types/smoothscroll-polyfill": "0.3.4",
"@types/sockjs-client": "1.5.4",
"@types/uuid": "10.0.0",
"@typescript-eslint/eslint-plugin": "8.0.0",
"@typescript-eslint/parser": "8.0.0",
"@typescript-eslint/eslint-plugin": "8.0.1",
"@typescript-eslint/parser": "8.0.1",
"eslint": "9.8.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-deprecation": "3.0.0",
"eslint-plugin-jest": "28.6.0",
"eslint-plugin-jest": "28.8.0",
"eslint-plugin-jest-extended": "2.4.0",
"eslint-plugin-prettier": "5.2.1",
"folder-hash": "4.0.4",
Expand All @@ -161,7 +161,7 @@
"prettier": "3.3.3",
"sass": "1.77.8",
"ts-jest": "29.2.4",
"typescript": "5.4.5",
"typescript": "5.5.4",
"weak-napi": "2.0.2"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ public interface LearningObject {
Long getId();

Set<CourseCompetency> getCompetencies();

boolean isVisibleToStudents();
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public Competency(String title, String description, ZonedDateTime softDueDate, I
super(title, description, softDueDate, masteryThreshold, taxonomy, optional);
}

public Competency(CourseCompetency courseCompetency) {
super(courseCompetency.getTitle(), courseCompetency.getDescription(), courseCompetency.getSoftDueDate(), courseCompetency.getMasteryThreshold(),
courseCompetency.getTaxonomy(), courseCompetency.isOptional());
}

public Competency() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ public Prerequisite(String title, String description, ZonedDateTime softDueDate,
super(title, description, softDueDate, masteryThreshold, taxonomy, optional);
}

public Prerequisite(CourseCompetency courseCompetency) {
super(courseCompetency.getTitle(), courseCompetency.getDescription(), courseCompetency.getSoftDueDate(), courseCompetency.getMasteryThreshold(),
courseCompetency.getTaxonomy(), courseCompetency.isOptional());
if (courseCompetency instanceof Competency) {
setLinkedCourseCompetency(courseCompetency);
}
else {
setLinkedCourseCompetency(courseCompetency.getLinkedCourseCompetency());
}
}

public Prerequisite() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,18 @@ public void setCompletedUsers(Set<LectureUnitCompletion> completedUsers) {
this.completedUsers = completedUsers;
}

/**
* Checks if the lecture unit is visible to the students.
* A lecture unit is visible to the students if the lecture is visible to the students and the release date is null or in the past.
*
* @return true if the lecture unit is visible to the students, false otherwise
*/
@JsonProperty("visibleToStudents")
public boolean isVisibleToStudents() {
if (lecture == null || !lecture.isVisibleToStudents()) {
return false;
}

if (releaseDate == null) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import java.util.Optional;
import java.util.Set;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Profile;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
Expand Down Expand Up @@ -48,81 +45,10 @@ public interface CompetencyRepository extends ArtemisJpaRepository<Competency, L
LEFT JOIN FETCH c.exercises
WHERE c.id = :competencyId
""")
Optional<Competency> findWithLectureUnitsAndExercisesById(@Param("competencyId") long competencyId);
Optional<Competency> findByIdWithLectureUnitsAndExercises(@Param("competencyId") long competencyId);

@Query("""
SELECT c
FROM Competency c
LEFT JOIN FETCH c.exercises ex
WHERE c.id = :competencyId
""")
Optional<Competency> findByIdWithExercises(@Param("competencyId") long competencyId);

/**
* Query which fetches all competencies for which the user is editor or instructor in the course and
* matching the search criteria.
*
* @param partialTitle competency title search term
* @param partialDescription competency description search term
* @param partialCourseTitle course title search term
* @param semester semester search term
* @param groups user groups
* @param pageable Pageable
* @return Page with search results
*/
@Query("""
SELECT c
FROM Competency c
WHERE (c.course.instructorGroupName IN :groups OR c.course.editorGroupName IN :groups)
AND (:partialTitle IS NULL OR c.title LIKE %:partialTitle%)
AND (:partialDescription IS NULL OR c.description LIKE %:partialDescription%)
AND (:partialCourseTitle IS NULL OR c.course.title LIKE %:partialCourseTitle%)
AND (:semester IS NULL OR c.course.semester = :semester)
""")
Page<Competency> findForImportAndUserHasAccessToCourse(@Param("partialTitle") String partialTitle, @Param("partialDescription") String partialDescription,
@Param("partialCourseTitle") String partialCourseTitle, @Param("semester") String semester, @Param("groups") Set<String> groups, Pageable pageable);

/**
* Query which fetches all competencies matching the search criteria.
*
* @param partialTitle competency title search term
* @param partialDescription competency description search term
* @param partialCourseTitle course title search term
* @param semester semester search term
* @param pageable Pageable
* @return Page with search results
*/
@Query("""
SELECT c
FROM Competency c
WHERE (:partialTitle IS NULL OR c.title LIKE %:partialTitle%)
AND (:partialDescription IS NULL OR c.description LIKE %:partialDescription%)
AND (:partialCourseTitle IS NULL OR c.course.title LIKE %:partialCourseTitle%)
AND (:semester IS NULL OR c.course.semester = :semester)
""")
Page<Competency> findForImport(@Param("partialTitle") String partialTitle, @Param("partialDescription") String partialDescription,
@Param("partialCourseTitle") String partialCourseTitle, @Param("semester") String semester, Pageable pageable);

/**
* Returns the title of the competency with the given id.
*
* @param competencyId the id of the competency
* @return the name/title of the competency or null if the competency does not exist
*/
@Query("""
SELECT c.title
FROM Competency c
WHERE c.id = :competencyId
""")
@Cacheable(cacheNames = "competencyTitle", key = "#competencyId", unless = "#result == null")
String getCompetencyTitle(@Param("competencyId") long competencyId);

default Competency findByIdWithExercisesElseThrow(long competencyId) {
return getValueElseThrow(findByIdWithExercises(competencyId), competencyId);
}

default Competency findWithLectureUnitsAndExercisesByIdElseThrow(long competencyId) {
return getValueElseThrow(findWithLectureUnitsAndExercisesById(competencyId), competencyId);
default Competency findByIdWithLectureUnitsAndExercisesElseThrow(long competencyId) {
return getValueElseThrow(findByIdWithLectureUnitsAndExercises(competencyId), competencyId);
}

default Competency findByIdWithLectureUnitsElseThrow(long competencyId) {
Expand All @@ -132,6 +58,4 @@ default Competency findByIdWithLectureUnitsElseThrow(long competencyId) {
long countByCourse(Course course);

List<Competency> findByCourseIdOrderById(long courseId);

boolean existsByIdAndCourseId(long competencyId, long courseId);
}
Loading

0 comments on commit 95c02d2

Please sign in to comment.