Merge remote-tracking branch 'origin/feature/own-learning-objects' into feature/own-learning-objects

# Conflicts:
#	backend/src/services/learning-paths/learning-path-provider.ts
#	backend/src/services/learning-paths/learning-path-service.ts
This commit is contained in:
Gerald Schmittinger 2025-03-11 06:18:20 +01:00
commit b539c28d8c
4 changed files with 41 additions and 31 deletions

View file

@ -19,14 +19,24 @@ const learningPathService = {
* @param source
* @param personalizedFor If this is set, a learning path personalized for the given group or student will be returned.
*/
async fetchLearningPaths(hruids: string[], language: Language, source: string, personalizedFor?: PersonalizationTarget): Promise<LearningPathResponse> {
async fetchLearningPaths(
hruids: string[],
language: Language,
source: string,
personalizedFor?: PersonalizationTarget
): Promise<LearningPathResponse> {
const userContentHruids = hruids.filter((hruid) => hruid.startsWith(userContentPrefix));
const nonUserContentHruids = hruids.filter((hruid) => !hruid.startsWith(userContentPrefix));
const userContentLearningPaths = await databaseLearningPathProvider.fetchLearningPaths(userContentHruids, language, source, personalizedFor);
const nonUserContentLearningPaths = await dwengoApiLearningPathProvider.fetchLearningPaths(nonUserContentHruids, language, source, personalizedFor);
const nonUserContentLearningPaths = await dwengoApiLearningPathProvider.fetchLearningPaths(
nonUserContentHruids,
language,
source,
personalizedFor
);
let result = (userContentLearningPaths.data || []).concat(nonUserContentLearningPaths.data || []);
const result = (userContentLearningPaths.data || []).concat(nonUserContentLearningPaths.data || []);
return {
data: result,