1
1
import _ from 'lodash' ;
2
2
3
3
import { knex } from '../../../../../db/knex-database-connection.js' ;
4
- import * as flashAssessmentResultRepository from '../../../../../lib/infrastructure/repositories/flash-assessment-result-repository.js' ;
5
- import * as flash from '../../../../certification/flash-certification/domain/services/algorithm-methods/flash.js' ;
6
- import * as dataFetcher from '../../../../evaluation/domain/services/algorithm-methods/data-fetcher.js' ;
7
4
import { convertLevelStagesIntoThresholds } from '../../../../evaluation/domain/services/stages/convert-level-stages-into-thresholds-service.js' ;
8
5
import { NotFoundError } from '../../../../shared/domain/errors.js' ;
9
6
import { Assessment } from '../../../../shared/domain/models/index.js' ;
10
7
import { AssessmentResult } from '../../../../shared/domain/read-models/participant-results/AssessmentResult.js' ;
11
- import * as answerRepository from '../../../../shared/infrastructure/repositories/answer-repository.js' ;
12
8
import * as areaRepository from '../../../../shared/infrastructure/repositories/area-repository.js' ;
13
- import * as challengeRepository from '../../../../shared/infrastructure/repositories/challenge-repository.js' ;
14
9
import * as competenceRepository from '../../../../shared/infrastructure/repositories/competence-repository.js' ;
15
10
import { repositories as sharedInjectedRepositories } from '../../../../shared/infrastructure/repositories/index.js' ;
16
11
import * as skillRepository from '../../../../shared/infrastructure/repositories/skill-repository.js' ;
@@ -36,9 +31,6 @@ import * as campaignRepository from '../../../campaign/infrastructure/repositori
36
31
const get = async function ( { userId, campaignId, badges, reachedStage, stages, locale } ) {
37
32
const participationResults = await _getParticipationResults ( userId , campaignId , locale ) ;
38
33
let flashScoringResults ;
39
- if ( participationResults . isFlash ) {
40
- flashScoringResults = await _getFlashScoringResults ( participationResults . assessmentId , locale ) ;
41
- }
42
34
const campaignDTO = await _getCampaignDTO ( campaignId ) ;
43
35
const isCampaignMultipleSendings = _isCampaignMultipleSendings ( campaignDTO ) ;
44
36
const isCampaignArchived = _isCampaignArchived ( campaignDTO ) ;
@@ -109,45 +101,6 @@ async function _getParticipationResults(userId, campaignId) {
109
101
} ;
110
102
}
111
103
112
- async function _getFlashScoringResults ( assessmentId , locale ) {
113
- const { allAnswers, challenges, estimatedLevel } = await dataFetcher . fetchForFlashCampaigns ( {
114
- assessmentId,
115
- locale,
116
- answerRepository,
117
- challengeRepository,
118
- flashAssessmentResultRepository,
119
- } ) ;
120
-
121
- const { pixScore, pixScoreByCompetence } = flash . calculateTotalPixScoreAndScoreByCompetence ( {
122
- allAnswers,
123
- challenges,
124
- capacity : estimatedLevel ,
125
- } ) ;
126
-
127
- const competences = await competenceRepository . findByRecordIds ( {
128
- competenceIds : pixScoreByCompetence . map ( ( { competenceId } ) => competenceId ) ,
129
- locale,
130
- } ) ;
131
-
132
- const areas = await areaRepository . list ( { locale } ) ;
133
-
134
- const competencesWithPixScore = _ . sortBy (
135
- pixScoreByCompetence . map ( ( { competenceId, pixScore } ) => {
136
- const competence = competences . find ( ( { id } ) => id === competenceId ) ;
137
- const area = areas . find ( ( { id } ) => id === competence . areaId ) ;
138
-
139
- return {
140
- competence,
141
- area,
142
- pixScore,
143
- } ;
144
- } ) ,
145
- 'competence.index' ,
146
- ) ;
147
-
148
- return { estimatedLevel, pixScore, competencesWithPixScore } ;
149
- }
150
-
151
104
async function _getParticipationAttributes ( userId , campaignId ) {
152
105
const participationAttributes = await knex ( 'campaign-participations' )
153
106
. select ( [
0 commit comments