Skip to content

Commit

Permalink
Merge branch 'develop' into chore/improve-query-performance
Browse files Browse the repository at this point in the history
  • Loading branch information
krusche authored Nov 11, 2024
2 parents aa29f16 + de36813 commit 7d38f24
Show file tree
Hide file tree
Showing 55 changed files with 1,487 additions and 860 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Refer to [Using JHipster in production](http://www.jhipster.tech/production) for
The following command can automate the deployment to a server. The example shows the deployment to the main Artemis test server (which runs a virtual machine):

```shell
./artemis-server-cli deploy [email protected] -w build/libs/Artemis-7.7.0.war
./artemis-server-cli deploy [email protected] -w build/libs/Artemis-7.7.1.war
```

## Architecture
Expand Down
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ plugins {
}

group = "de.tum.cit.aet.artemis"
version = "7.7.0"
version = "7.7.1"
description = "Interactive Learning with Individual Feedback"

java {
Expand Down Expand Up @@ -55,11 +55,15 @@ idea {
}

spotless {

// allows to execute the code formatting commands ./gradlew spotlessApply and ./gradlew spotlessCheck
java {
target {
fileTree(rootDir) {
include "**/*.java"
include (
"src/main/java/**/*.java",
"src/test/java/**/*.java",
)
exclude(
"**/src/test/resources/test-data/repository-export/EncodingISO_8559_1.java",
"**/node_modules/**",
Expand All @@ -71,7 +75,6 @@ spotless {
"**/src/main/resources/templates/**",
"/docker/**",
"checked-out-repos/**",
"**/src/main/java/org/eclipse/**",
"supporting_scripts/**"
)
}
Expand Down
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ module.exports = {
coverageThreshold: {
global: {
// TODO: in the future, the following values should increase to at least 90%
statements: 87.55,
branches: 73.68,
functions: 82.12,
lines: 87.61,
statements: 87.67,
branches: 73.81,
functions: 82.17,
lines: 87.72,
},
},
coverageReporters: ['clover', 'json', 'lcov', 'text-summary'],
Expand Down
15 changes: 1 addition & 14 deletions linting.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
#!/bin/sh
join_by () {
local IFS="$1";
shift;
echo "$*";
}

FILES=$(join_by "," "$@")

if [[ "$OSTYPE" == "msys" ]]; then
# replace backslashes with double backslashes in Windows file paths when
# using MinGW (msys = lightweight shell and GNU utilities compiled for Windows (part of MinGW)
FILES=$(echo $FILES | sed 's/\\/\\\\/g')
fi

./gradlew spotlessApply -PspotlessFiles="${FILES}"
./gradlew spotlessApply -PratchetFrom='develop'
37 changes: 35 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "artemis",
"version": "7.7.0",
"version": "7.7.1",
"description": "Interactive Learning with Individual Feedback",
"private": true,
"license": "MIT",
Expand Down Expand Up @@ -67,6 +67,7 @@
"ngx-infinite-scroll": "18.0.0",
"ngx-webstorage": "18.0.0",
"papaparse": "5.4.1",
"pdf-lib": "1.17.1",
"pdfjs-dist": "4.8.69",
"posthog-js": "1.181.0",
"rxjs": "7.8.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ SELECT COUNT(c)
@EntityGraph(type = LOAD, attributePaths = { "result.participation", "result.submission", "result.assessor" })
List<Complaint> getAllByResult_Assessor_IdAndResult_Participation_Exercise_Course_Id(Long assessorId, Long courseId);

// Valid JPQL syntax. Only SCA fails to properly detect the types.
/**
* Get the number of Complaints for all tutors of a course
*
Expand All @@ -267,8 +266,8 @@ SELECT COUNT(c)
SELECT new de.tum.cit.aet.artemis.assessment.dto.tutor.TutorLeaderboardComplaintsDTO(
r.assessor.id,
COUNT(c),
SUM( CASE WHEN (c.accepted = TRUE ) THEN 1L ELSE 0L END),
SUM( CASE WHEN (c.accepted = TRUE) THEN e.maxPoints ELSE 0.0 END)
SUM(CASE WHEN c.accepted = TRUE THEN 1L ELSE 0L END),
CAST(SUM(CASE WHEN c.accepted = TRUE THEN e.maxPoints ELSE 0.0 END) AS double)
)
FROM Complaint c
JOIN c.result r
Expand All @@ -282,7 +281,6 @@ SELECT COUNT(c)
""")
List<TutorLeaderboardComplaintsDTO> findTutorLeaderboardComplaintsByCourseId(@Param("courseId") long courseId);

// Valid JPQL syntax. Only SCA fails to properly detect the types.
/**
* Get the number of Complaints for all tutors of an exercise
*
Expand All @@ -293,8 +291,8 @@ SELECT COUNT(c)
SELECT new de.tum.cit.aet.artemis.assessment.dto.tutor.TutorLeaderboardComplaintsDTO(
r.assessor.id,
COUNT(c),
SUM( CASE WHEN (c.accepted = TRUE ) THEN 1L ELSE 0L END),
SUM( CASE WHEN (c.accepted = TRUE) THEN e.maxPoints ELSE 0.0 END)
SUM(CASE WHEN c.accepted = TRUE THEN 1L ELSE 0L END),
CAST(SUM(CASE WHEN c.accepted = TRUE THEN e.maxPoints ELSE 0.0 END) AS double)
)
FROM Complaint c
JOIN c.result r
Expand All @@ -308,7 +306,6 @@ SELECT COUNT(c)
""")
List<TutorLeaderboardComplaintsDTO> findTutorLeaderboardComplaintsByExerciseId(@Param("exerciseId") long exerciseId);

// Valid JPQL syntax. Only SCA fails to properly detect the types.
/**
* Get the number of Complaints for all tutors of an exam
*
Expand All @@ -319,8 +316,8 @@ SELECT COUNT(c)
SELECT new de.tum.cit.aet.artemis.assessment.dto.tutor.TutorLeaderboardComplaintsDTO(
r.assessor.id,
COUNT(c),
SUM( CASE WHEN (c.accepted = TRUE ) THEN 1L ELSE 0L END),
SUM( CASE WHEN (c.accepted = TRUE) THEN e.maxPoints ELSE 0.0 END)
SUM(CASE WHEN c.accepted = TRUE THEN 1L ELSE 0L END),
CAST(SUM(CASE WHEN c.accepted = TRUE THEN e.maxPoints ELSE 0.0 END) AS double)
)
FROM Complaint c
JOIN c.result r
Expand All @@ -345,7 +342,7 @@ SELECT COUNT(c)
SELECT new de.tum.cit.aet.artemis.assessment.dto.tutor.TutorLeaderboardComplaintResponsesDTO(
cr.reviewer.id,
COUNT(c),
SUM(e.maxPoints)
SUM(CAST(e.maxPoints AS double))
)
FROM Complaint c
JOIN c.complaintResponse cr
Expand Down Expand Up @@ -422,8 +419,8 @@ SELECT COUNT(c)
SELECT new de.tum.cit.aet.artemis.assessment.dto.tutor.TutorLeaderboardMoreFeedbackRequestsDTO(
r.assessor.id,
COUNT(c),
SUM( CASE WHEN (c.accepted IS NULL) THEN 1L ELSE 0L END),
SUM( CASE WHEN (c.accepted IS NULL) THEN e.maxPoints ELSE 0.0 END)
SUM(CASE WHEN c.accepted IS NULL THEN 1L ELSE 0L END),
CAST(SUM(CASE WHEN c.accepted IS NULL THEN e.maxPoints ELSE 0.0 END) AS double)
)
FROM Complaint c
JOIN c.result r
Expand All @@ -447,8 +444,8 @@ SELECT COUNT(c)
SELECT new de.tum.cit.aet.artemis.assessment.dto.tutor.TutorLeaderboardMoreFeedbackRequestsDTO(
r.assessor.id,
COUNT(c),
SUM( CASE WHEN (c.accepted IS NULL) THEN 1L ELSE 0L END),
SUM( CASE WHEN (c.accepted IS NULL) THEN e.maxPoints ELSE 0.0 END)
SUM(CASE WHEN c.accepted IS NULL THEN 1L ELSE 0L END),
CAST(SUM(CASE WHEN c.accepted IS NULL THEN e.maxPoints ELSE 0.0 END) AS double)
)
FROM Complaint c
JOIN c.result r
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,6 @@ else if (Boolean.FALSE.equals(ratedCount.rated())) {
""")
List<TutorLeaderboardAssessmentsDTO> findTutorLeaderboardAssessmentByExerciseId(@Param("exerciseId") long exerciseId);

// Valid JPQL syntax, only SCA is not able to parse it due to mixing primitive and object types
@Query("""
SELECT new de.tum.cit.aet.artemis.assessment.dto.tutor.TutorLeaderboardAssessmentsDTO(
r.assessor.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public interface FeedbackCleanupRepository extends ArtemisJpaRepository<Feedback

/**
* Deletes {@link Feedback} entries where the associated {@link Result} has no submission and no participation.
*
* @return the number of deleted entities
*/
@Modifying
@Transactional // ok because of delete
Expand All @@ -39,18 +41,20 @@ WHERE f.result IN (
AND r.participation IS NULL
)
""")
void deleteFeedbackForOrphanResults();
int deleteFeedbackForOrphanResults();

/**
* Deletes {@link Feedback} entries with a {@code null} result.
*
* @return the number of deleted entities
*/
@Modifying
@Transactional // ok because of delete
@Query("""
DELETE FROM Feedback f
WHERE f.result IS NULL
""")
void deleteOrphanFeedback();
int deleteOrphanFeedback();

/**
* Deletes {@link Feedback} entries associated with rated {@link Result} that are not the latest rated result
Expand All @@ -60,6 +64,7 @@ WHERE f.result IN (
*
* @param deleteFrom the start date for selecting courses
* @param deleteTo the end date for selecting courses
* @return the number of deleted entities
*/
@Modifying
@Transactional // ok because of delete
Expand All @@ -82,7 +87,7 @@ SELECT MAX(r2.id)
AND c.startDate > :deleteFrom
)
""")
void deleteOldFeedbackThatAreNotLatestRatedResultsWhereCourseDateBetween(@Param("deleteFrom") ZonedDateTime deleteFrom, @Param("deleteTo") ZonedDateTime deleteTo);
int deleteOldFeedbackThatAreNotLatestRatedResultsWhereCourseDateBetween(@Param("deleteFrom") ZonedDateTime deleteFrom, @Param("deleteTo") ZonedDateTime deleteTo);

/**
* Deletes non-rated {@link Feedback} entries that are not the latest non-rated result, where the associated course's start and end dates
Expand All @@ -92,6 +97,7 @@ SELECT MAX(r2.id)
*
* @param deleteFrom the start date for selecting courses
* @param deleteTo the end date for selecting courses
* @return the number of deleted entities
*/
@Modifying
@Transactional // ok because of delete
Expand All @@ -113,5 +119,5 @@ SELECT MAX(r2.id)
AND c.startDate > :deleteFrom
)
""")
void deleteOldNonRatedFeedbackWhereCourseDateBetween(@Param("deleteFrom") ZonedDateTime deleteFrom, @Param("deleteTo") ZonedDateTime deleteTo);
int deleteOldNonRatedFeedbackWhereCourseDateBetween(@Param("deleteFrom") ZonedDateTime deleteFrom, @Param("deleteTo") ZonedDateTime deleteTo);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public interface LongFeedbackTextCleanupRepository extends ArtemisJpaRepository<
/**
* Deletes {@link LongFeedbackText} entries linked to {@link Feedback} where the associated
* {@link Result} has no participation and no submission.
*
* @return the number of deleted entities
*/
@Modifying
@Transactional // ok because of delete
Expand All @@ -40,10 +42,12 @@ WHERE lft.feedback.id IN (
AND f.result.submission IS NULL
)
""")
void deleteLongFeedbackTextForOrphanResult();
int deleteLongFeedbackTextForOrphanResult();

/**
* Deletes {@link LongFeedbackText} linked to {@link Feedback} with a {@code null} result.
*
* @return the number of deleted {@link LongFeedbackText} entities
*/
@Modifying
@Transactional // ok because of delete
Expand All @@ -55,7 +59,7 @@ WHERE lft.feedback IN (
WHERE f.result IS NULL
)
""")
void deleteLongFeedbackTextForOrphanedFeedback();
int deleteLongFeedbackTextForOrphanedFeedback();

/**
* Deletes {@link LongFeedbackText} entries associated with rated {@link Result} that are not the latest rated result
Expand All @@ -65,6 +69,7 @@ WHERE lft.feedback IN (
*
* @param deleteFrom the start date for selecting courses
* @param deleteTo the end date for selecting courses
* @return the number of deleted entities
*/
@Modifying
@Transactional // ok because of delete
Expand All @@ -88,7 +93,7 @@ SELECT MAX(r2.id)
AND r.rated = TRUE
)
""")
void deleteLongFeedbackTextForRatedResultsWhereCourseDateBetween(@Param("deleteFrom") ZonedDateTime deleteFrom, @Param("deleteTo") ZonedDateTime deleteTo);
int deleteLongFeedbackTextForRatedResultsWhereCourseDateBetween(@Param("deleteFrom") ZonedDateTime deleteFrom, @Param("deleteTo") ZonedDateTime deleteTo);

/**
* Deletes {@link LongFeedbackText} entries linked to non-rated {@link Feedback} that are not the latest non-rated result where the associated course's start
Expand All @@ -98,6 +103,7 @@ SELECT MAX(r2.id)
*
* @param deleteFrom the start date for selecting courses
* @param deleteTo the end date for selecting courses
* @return the number of deleted entities
*/
@Modifying
@Transactional // ok because of delete
Expand All @@ -121,5 +127,5 @@ SELECT MAX(r2.id)
AND c.startDate > :deleteFrom
)
""")
void deleteLongFeedbackTextForNonRatedResultsWhereCourseDateBetween(@Param("deleteFrom") ZonedDateTime deleteFrom, @Param("deleteTo") ZonedDateTime deleteTo);
int deleteLongFeedbackTextForNonRatedResultsWhereCourseDateBetween(@Param("deleteFrom") ZonedDateTime deleteFrom, @Param("deleteTo") ZonedDateTime deleteTo);
}
Loading

0 comments on commit 7d38f24

Please sign in to comment.