Skip to content

Commit

Permalink
Adaptive learning: Use competency link weight for learning path recom…
Browse files Browse the repository at this point in the history
…mendations and mastery calculation (#9565)
  • Loading branch information
JohannesStoehr authored Oct 30, 2024
1 parent 5562d95 commit 998d6c0
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/**
* Enum to define the different reasons why the confidence is above/below 1 in the {@link CompetencyProgress}.
* A confidence != 1 leads to a higher/lower mastery, which is displayed to the student together with the reason.
* Also see {@link CompetencyProgress#setConfidenceReason}.
* Also see {@link de.tum.cit.aet.artemis.atlas.service.competency.CompetencyProgressService#setConfidenceReason}.
*/
public enum CompetencyProgressConfidenceReason {
NO_REASON, RECENT_SCORES_LOWER, RECENT_SCORES_HIGHER, MORE_EASY_POINTS, MORE_HARD_POINTS, QUICKLY_SOLVED_EXERCISES
NO_REASON, RECENT_SCORES_LOWER, RECENT_SCORES_HIGHER, MORE_EASY_POINTS, MORE_HARD_POINTS, QUICKLY_SOLVED_EXERCISES, MORE_LOW_WEIGHTED_EXERCISES, MORE_HIGH_WEIGHTED_EXERCISES
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
import de.tum.cit.aet.artemis.exercise.domain.DifficultyLevel;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record CompetencyExerciseMasteryCalculationDTO(double maxPoints, DifficultyLevel difficulty, boolean isProgrammingExercise, Double lastScore, Double lastPoints,
Instant lastModifiedDate, long submissionCount) {
public record CompetencyExerciseMasteryCalculationDTO(long exerciseId, double maxPoints, DifficultyLevel difficulty, boolean isProgrammingExercise, double competencyLinkWeight,
Double lastScore, Double lastPoints, Instant lastModifiedDate, long submissionCount) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package de.tum.cit.aet.artemis.atlas.dto.metrics;

import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record CompetencyLectureUnitMasteryCalculationDTO(long lectureUnitId, boolean completed, double competencyLinkWeight) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import de.tum.cit.aet.artemis.atlas.domain.LearningObject;
import de.tum.cit.aet.artemis.atlas.domain.competency.CourseCompetency;
import de.tum.cit.aet.artemis.atlas.dto.metrics.CompetencyExerciseMasteryCalculationDTO;
import de.tum.cit.aet.artemis.atlas.dto.metrics.CompetencyLectureUnitMasteryCalculationDTO;
import de.tum.cit.aet.artemis.core.domain.User;
import de.tum.cit.aet.artemis.core.repository.base.ArtemisJpaRepository;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
Expand Down Expand Up @@ -106,9 +107,11 @@ default CourseCompetency findByIdWithExercisesAndLectureUnitsAndLecturesElseThro
*/
@Query("""
SELECT new de.tum.cit.aet.artemis.atlas.dto.metrics.CompetencyExerciseMasteryCalculationDTO(
e.id,
e.maxPoints,
e.difficulty,
CASE WHEN TYPE(e) = ProgrammingExercise THEN TRUE ELSE FALSE END,
el.weight,
COALESCE(sS.lastScore, tS.lastScore),
COALESCE(sS.lastPoints, tS.lastPoints),
COALESCE(sS.lastModifiedDate, tS.lastModifiedDate),
Expand All @@ -123,9 +126,34 @@ 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.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), sS.lastScore, tS.lastScore, sS.lastPoints, tS.lastPoints, sS.lastModifiedDate, tS.lastModifiedDate
""")
Set<CompetencyExerciseMasteryCalculationDTO> findAllExerciseInfoByCompetencyId(@Param("competencyId") long competencyId, @Param("user") User user);
Set<CompetencyExerciseMasteryCalculationDTO> findAllExerciseInfoByCompetencyIdAndUser(@Param("competencyId") long competencyId, @Param("user") User user);

/**
* Fetches all information related to the calculation of the mastery for lecture units in a competency.
* The complex grouping by is necessary for postgres
*
* @param competencyId the id of the competency for which to fetch the lecture unit information
* @param user the user for which to fetch the lecture unit information
* @return the lecture unit information for the calculation of the mastery in the competency
*/
@Query("""
SELECT new de.tum.cit.aet.artemis.atlas.dto.metrics.CompetencyLectureUnitMasteryCalculationDTO(
lu.id,
CASE WHEN u IS NOT NULL THEN TRUE ELSE FALSE END,
lul.weight
)
FROM CourseCompetency c
LEFT JOIN c.lectureUnitLinks lul
LEFT JOIN lul.lectureUnit lu
LEFT JOIN lu.completedUsers cu
LEFT JOIN cu.user u ON u = :user
WHERE c.id = :competencyId
AND lu IS NOT NULL
GROUP BY lu.id, u, lul.weight, u
""")
Set<CompetencyLectureUnitMasteryCalculationDTO> findAllLectureUnitInfoByCompetencyIdAndUser(@Param("competencyId") long competencyId, @Param("user") User user);

@Query("""
SELECT c
Expand Down
Loading

0 comments on commit 998d6c0

Please sign in to comment.