Skip to content
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
609 changes: 0 additions & 609 deletions api.md

This file was deleted.

6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ repositories {

dependencies {

implementation 'de.unistuttgart.iste.meitrex:meitrex-common:1.2.6'
implementation 'de.unistuttgart.iste.meitrex:content_service:1.0.8'
implementation 'de.unistuttgart.iste.meitrex:meitrex-common:1.4.4'
implementation 'de.unistuttgart.iste.meitrex:content_service:1.5.0rc1'

implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-graphql'
Expand All @@ -127,7 +127,7 @@ dependencies {
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'de.unistuttgart.iste.meitrex:meitrex-common-test:1.2.6'
testImplementation 'de.unistuttgart.iste.meitrex:meitrex-common-test:1.4.4'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework:spring-webflux'
testImplementation 'org.springframework.graphql:spring-graphql-test'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package de.unistuttgart.iste.meitrex.skilllevel_service.service.calculation;


import de.unistuttgart.iste.meitrex.common.dapr.TopicPublisher;
import de.unistuttgart.iste.meitrex.common.event.ItemResponse;
import de.unistuttgart.iste.meitrex.common.event.LevelOfBloomsTaxonomy;
import de.unistuttgart.iste.meitrex.common.event.skilllevels.UserSkillLevelChangedEvent;
import de.unistuttgart.iste.meitrex.generated.dto.BloomLevel;
import de.unistuttgart.iste.meitrex.skilllevel_service.persistence.entity.*;
import de.unistuttgart.iste.meitrex.skilllevel_service.persistence.repository.AllSkillLevelsRepository;
Expand Down Expand Up @@ -34,6 +35,7 @@ public class SkillLevelCalculator {
private final BloomLevelAbilityRepository bloomLevelAbilityRepository;

private final AllSkillLevelsRepository allSkillLevelsRepository;
private final TopicPublisher topicPublisher;

private final static float ALPHA = 0.05f;
private final static float BETA = 1f;
Expand Down Expand Up @@ -82,8 +84,7 @@ private void calculate(final UUID userId, final ItemResponse response) {
skillAbilities.add(ability.getAbility());
}
List<Float> bloomLevelAbilities = new ArrayList<Float>();
for (LevelOfBloomsTaxonomy levelOfBloomsTaxonomy : response.getLevelsOfBloomsTaxonomy()) {
BloomLevel level = mapLevelOfBloomsTaxonomyToBloomLevel(levelOfBloomsTaxonomy);
for (BloomLevel level : response.getLevelsOfBloomsTaxonomy()) {
BloomLevelAbilityEntity ability = bloomLevelAbilityRepository.findByUserIdAndBloomLevel(userId, level);
if (ability == null) {
ability = createBloomAbility(userId, level);
Expand All @@ -103,8 +104,7 @@ private void calculate(final UUID userId, final ItemResponse response) {
for (UUID skillId : response.getSkillIds()) {
updateSkillAbility(userId, skillId, difficulty, correctResponse, alpha);
}
for (LevelOfBloomsTaxonomy levelOfBloomsTaxonomy : response.getLevelsOfBloomsTaxonomy()) {
BloomLevel level = mapLevelOfBloomsTaxonomyToBloomLevel(levelOfBloomsTaxonomy);
for (BloomLevel level : response.getLevelsOfBloomsTaxonomy()) {
updateBloomLevelAbilities(userId, level, difficulty, correctResponse, alpha);
}
updateSkillLevels(response, userId, prediction);
Expand All @@ -119,8 +119,7 @@ private void calculate(final UUID userId, final ItemResponse response) {
*/
private void updateSkillLevels(ItemResponse response, UUID userId, float prediction) {
for (UUID skillId : response.getSkillIds()) {
for (LevelOfBloomsTaxonomy levelOfBloomsTaxonomy : response.getLevelsOfBloomsTaxonomy()) {
BloomLevel level = mapLevelOfBloomsTaxonomyToBloomLevel(levelOfBloomsTaxonomy);
for (BloomLevel level : response.getLevelsOfBloomsTaxonomy()) {
updateSkillLevel(userId, skillId, level, response.getItemId(), response.getResponse(), prediction);
}
}
Expand Down Expand Up @@ -170,6 +169,13 @@ private void updateSkillLevel(UUID userId, UUID skillId, BloomLevel bloomLevel,
}
setSkillLevelEntityBySkillType(entity, bloomLevel, skillLevelEntity);
allSkillLevelsRepository.save(entity);
topicPublisher.notifyUserSkillLevelChanged(UserSkillLevelChangedEvent.builder()
.userId(userId)
.skillId(skillId)
.bloomLevel(bloomLevel)
.oldValue(oldAbility)
.newValue(newAbility)
.build());
}

/**
Expand Down Expand Up @@ -415,21 +421,4 @@ private SkillLevelEntity initializeSkillLevelEntity(final float initialValue) {
skillLevelEntity.setLog(new ArrayList<>());
return skillLevelEntity;
}

/***
* maps the Level of Blooms Taxonomy from Dapr Topic to the same Level of Blooms Taxonomy of the DTO
* @param levelOfBloomsOfBloomsTaxonomy level of blooms Taxonomy
* @return mapped level for the DTO
*/
private BloomLevel mapLevelOfBloomsTaxonomyToBloomLevel(LevelOfBloomsTaxonomy levelOfBloomsOfBloomsTaxonomy) {
return switch (levelOfBloomsOfBloomsTaxonomy) {
case LevelOfBloomsTaxonomy.UNDERSTAND -> BloomLevel.UNDERSTAND;
case LevelOfBloomsTaxonomy.REMEMBER -> BloomLevel.REMEMBER;
case LevelOfBloomsTaxonomy.APPLY -> BloomLevel.APPLY;
case LevelOfBloomsTaxonomy.ANALYZE -> BloomLevel.ANALYZE;
case LevelOfBloomsTaxonomy.EVALUATE -> BloomLevel.EVALUATE;
case LevelOfBloomsTaxonomy.CREATE -> BloomLevel.CREATE;
};
}

}
2 changes: 2 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ spring.profiles.active=prod
spring.graphql.graphiql.enabled=true
spring.graphql.graphiql.path=/graphiql

spring.graphql.schema.locations=classpath*:graphql/common/**/,classpath:graphql/**

# increase max request header size because we transmit authorization data in the header and this might get large
# if the user is in a lot of courses
server.max-http-request-header-size=64000
Expand Down
11 changes: 0 additions & 11 deletions src/main/resources/graphql/common/bloomLevels.graphqls

This file was deleted.

23 changes: 0 additions & 23 deletions src/main/resources/graphql/common/directives.graphqls

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/resources/graphql/common/scalars.graphqls

This file was deleted.

104 changes: 0 additions & 104 deletions src/main/resources/graphql/common/sortFilterPagination.graphqls

This file was deleted.

Loading
Loading