Skip to content

Commit

Permalink
Merge branch 'develop' into feature/communication/add-profile-picture…
Browse files Browse the repository at this point in the history
…-to-user-selector
  • Loading branch information
asliayk authored Nov 13, 2024
2 parents 36a3c03 + 054476c commit 387dcdc
Show file tree
Hide file tree
Showing 40 changed files with 430 additions and 243 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ public interface ParticipantScoreRepository extends ArtemisJpaRepository<Partici
""")
List<ParticipantScore> findAllOutdated();

@Override
@EntityGraph(type = LOAD, attributePaths = { "exercise", "lastResult", "lastRatedResult" })
List<ParticipantScore> findAll();

@EntityGraph(type = LOAD, attributePaths = { "exercise", "lastResult", "lastRatedResult" })
List<ParticipantScore> findAllByExercise(Exercise exercise);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ CASE WHEN TYPE(e) = ProgrammingExercise THEN TRUE ELSE FALSE END,
LEFT JOIN TeamScore tS ON tS.exercise = e AND :user MEMBER OF tS.team.students
WHERE c.id = :competencyId
AND e IS NOT NULL
GROUP BY e.id, e.maxPoints, e.difficulty, TYPE(e), sS.lastScore, tS.lastScore, sS.lastPoints, tS.lastPoints, sS.lastModifiedDate, tS.lastModifiedDate
GROUP BY e.id, e.maxPoints, e.difficulty, TYPE(e), el.weight, sS.lastScore, tS.lastScore, sS.lastPoints, tS.lastPoints, sS.lastModifiedDate, tS.lastModifiedDate
""")
Set<CompetencyExerciseMasteryCalculationDTO> findAllExerciseInfoByCompetencyIdAndUser(@Param("competencyId") long competencyId, @Param("user") User user);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public void importStandardizedCompetencyCatalog(StandardizedCompetencyCatalogDTO
*/
public String exportStandardizedCompetencyCatalog() {
List<KnowledgeArea> knowledgeAreas = getAllForTreeView();
// TODO: we should avoid using findAll() here, as it might return a huge amount of data
List<Source> sources = sourceRepository.findAll();
var catalog = StandardizedCompetencyCatalogDTO.of(knowledgeAreas, sources);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package de.tum.cit.aet.artemis.core.dto;

import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record CourseGroupsDTO(String instructorGroupName, String editorGroupName, String teachingAssistantGroupName, String studentGroupName) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import de.tum.cit.aet.artemis.core.domain.Organization;
import de.tum.cit.aet.artemis.core.domain.User;
import de.tum.cit.aet.artemis.core.dto.CourseForArchiveDTO;
import de.tum.cit.aet.artemis.core.dto.CourseGroupsDTO;
import de.tum.cit.aet.artemis.core.dto.StatisticsEntry;
import de.tum.cit.aet.artemis.core.exception.EntityNotFoundException;
import de.tum.cit.aet.artemis.core.repository.base.ArtemisJpaRepository;
Expand Down Expand Up @@ -323,14 +324,6 @@ GROUP BY SUBSTRING(CAST(s.submissionDate AS string), 1, 10), p.student.login
""")
List<Course> findAllNotEndedCoursesByManagementGroupNames(@Param("now") ZonedDateTime now, @Param("userGroups") List<String> userGroups);

@Query("""
SELECT COUNT(DISTINCT ug.userId)
FROM Course c
JOIN UserGroup ug ON c.studentGroupName = ug.group
WHERE c.id = :courseId
""")
int countCourseStudents(@Param("courseId") long courseId);

/**
* Counts the number of members of a course, i.e. users that are a member of the course's student, tutor, editor or instructor group.
* Users that are part of multiple groups are NOT counted multiple times.
Expand Down Expand Up @@ -569,4 +562,23 @@ SELECT COUNT(c) > 0
Set<CourseForArchiveDTO> findInactiveCoursesForUserRolesWithNonNullSemester(@Param("isAdmin") boolean isAdmin, @Param("groups") Set<String> groups,
@Param("now") ZonedDateTime now);

@Query("""
SELECT new de.tum.cit.aet.artemis.core.dto.CourseGroupsDTO(
c.instructorGroupName,
c.editorGroupName,
c.teachingAssistantGroupName,
c.studentGroupName
) FROM Course c
""")
Set<CourseGroupsDTO> findAllCourseGroups();

@Query("""
SELECT c
FROM Course c
WHERE c.teachingAssistantGroupName IN :userGroups
OR c.editorGroupName IN :userGroups
OR c.instructorGroupName IN :userGroups
OR :isAdmin = TRUE
""")
List<Course> findCoursesForAtLeastTutorWithGroups(@Param("userGroups") Set<String> userGroups, @Param("isAdmin") boolean isAdmin);
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ OR EXISTS (SELECT c FROM Course c WHERE submission.participation.exercise.course
*
* @param startDate the minimum submission date
* @param endDate the maximum submission date
* @return a list of active users
* @return a count of active users
*/
@Query("""
SELECT COUNT(DISTINCT p.student.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ public List<Course> getAllCoursesForManagementOverview(boolean onlyActive) {
var user = userRepository.getUserWithGroupsAndAuthorities();
boolean isAdmin = authCheckService.isAdmin(user);
if (isAdmin && !onlyActive) {
// TODO: we should avoid using findAll() here, as it might return a huge amount of data
return courseRepository.findAll();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.apache.sshd.common.config.keys.AuthorizedKeyEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
Expand Down Expand Up @@ -58,9 +57,6 @@ public class AccountResource {

public static final String ENTITY_NAME = "user";

@Value("${jhipster.clientApp.name}")
private String applicationName;

private static final Logger log = LoggerFactory.getLogger(AccountResource.class);

private final UserRepository userRepository;
Expand Down
Loading

0 comments on commit 387dcdc

Please sign in to comment.