diff --git a/src/scoring/scoring.controller.ts b/src/scoring/scoring.controller.ts index 4d50eac..3572700 100644 --- a/src/scoring/scoring.controller.ts +++ b/src/scoring/scoring.controller.ts @@ -24,8 +24,11 @@ export class ScoringController { @Param('lecture_id') lecture_id: number, @Param('prof_id') prof_id?: number, ): Promise { + console.log('ing'); await this.scoringService.scoring(lecture_id, prof_id); + console.log('out scoring func'); await this.scoringService.updateScoring(lecture_id, prof_id); + console.log('out update scoring func'); return await this.scoringService.getScoring(lecture_id, prof_id); } diff --git a/src/scoring/scoring.service.ts b/src/scoring/scoring.service.ts index 9bb309c..5058647 100644 --- a/src/scoring/scoring.service.ts +++ b/src/scoring/scoring.service.ts @@ -222,6 +222,7 @@ export class ScoringService { main_lecture_id: number, prof_id?: number, ) { + console.log('in scoring function'); // let prof_id = prof_i1d; let i: number; let diff_sum = 0; @@ -260,7 +261,12 @@ export class ScoringService { inter_sum = inter_sum / i; lots_sum = lots_sum / i; sati_sum = sati_sum / i; - + console.log('diff sum' + diff_sum); + console.log('stren sum' + stren_sum); + console.log('help sum' + help_sum); + console.log('inter sum' + inter_sum); + console.log('lots sum' + lots_sum); + console.log('sati sum' + sati_sum); // total_score = // (diff_sum + stren_sum + help_sum + inter_sum + lots_sum + sati_sum) / 6; const found = await this.lectureRepository.findOne({ @@ -288,12 +294,12 @@ export class ScoringService { const scoring = new Scoring(); scoring.lecture_id = main_lecture_id * 1; - scoring.diff_aver = diff_sum; - scoring.stren_aver = stren_sum; - scoring.help_aver = help_sum; - scoring.inter_aver = inter_sum; - scoring.lots_aver = lots_sum; - scoring.sati_aver = sati_sum; + scoring.diff_aver = Math.floor(diff_sum); + scoring.stren_aver = Math.floor(stren_sum); + scoring.help_aver = Math.floor(help_sum); + scoring.inter_aver = Math.floor(inter_sum); + scoring.lots_aver = Math.floor(lots_sum); + scoring.sati_aver = Math.floor(sati_sum); scoring.people = people; scoring.good = good; scoring.bad = bad; @@ -336,12 +342,12 @@ export class ScoringService { }, }); scoring.lecture_id = main_lecture_id * 1; - scoring.diff_aver = diff_sum; - scoring.stren_aver = stren_sum; - scoring.help_aver = help_sum; - scoring.inter_aver = inter_sum; - scoring.lots_aver = lots_sum; - scoring.sati_aver = sati_sum; + scoring.diff_aver = Math.floor(diff_sum); + scoring.stren_aver = Math.floor(stren_sum); + scoring.help_aver = Math.floor(help_sum); + scoring.inter_aver = Math.floor(inter_sum); + scoring.lots_aver = Math.floor(lots_sum); + scoring.sati_aver = Math.floor(sati_sum); scoring.people = people; scoring.good = good; scoring.bad = bad;