Skip to content

Commit

Permalink
[FEATURE] Message de warning pour épreuve jouable sans acquis (PIX-15858
Browse files Browse the repository at this point in the history
  • Loading branch information
pix-service-auto-merge authored Dec 24, 2024
2 parents fb258f0 + 8bc9b1c commit 54c7425
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import { NotFoundError } from '../../domain/errors.js';
import { Accessibility } from '../../domain/models/Challenge.js';
import { Challenge } from '../../domain/models/index.js';
import * as solutionAdapter from '../../infrastructure/adapters/solution-adapter.js';
import { child, SCOPES } from '../utils/logger.js';
import { LearningContentRepository } from './learning-content-repository.js';

const logger = child('learningcontent:repository', { event: SCOPES.LEARNING_CONTENT });

const TABLE_NAME = 'learningcontent.challenges';
const VALIDATED_STATUS = 'validé';
const ARCHIVED_STATUS = 'archivé';
Expand Down Expand Up @@ -215,6 +218,10 @@ function toDomain({ challengeDto, webComponentTagName, webComponentProps, skill,
solution,
});

if (OPERATIVE_STATUSES.includes(challengeDto.status) && !skill) {
logger.warn({ challenge: challengeDto }, 'operative challenge has no skill');
}

return new Challenge({
id: challengeDto.id,
type: challengeDto.type,
Expand Down

0 comments on commit 54c7425

Please sign in to comment.