Skip to content

Commit

Permalink
[TECH] Monter la version d'ember-source orga en V6 (PIX-15770)
Browse files Browse the repository at this point in the history
  • Loading branch information
pix-service-auto-merge authored Dec 20, 2024
2 parents bbbcf19 + effcff5 commit c87594c
Show file tree
Hide file tree
Showing 17 changed files with 111 additions and 839 deletions.
67 changes: 67 additions & 0 deletions orga/app/components/participant/assessment/results.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import PixProgressBar from '@1024pix/pix-ui/components/pix-progress-bar';
import { t } from 'ember-intl';

import multiply from '../../../helpers/multiply';
import TableHeader from '../../table/header';

function sortedCompetenceResults(results) {
return results.sort((a, b) => {
return a.index.localeCompare(b.index);
});
}

function displayResults(results) {
return results.length > 0;
}

function competenceCount(results) {
return results.length;
}

<template>
<section class="panel panel--light-shadow participant-results__details">
<h3 class="screen-reader-only">{{t "pages.assessment-individual-results.table.title"}}</h3>

<table class="content-text content-text--small">
<thead>
<tr>
<TableHeader @size="wide">{{t
"pages.assessment-individual-results.table.column.competences"
count=(competenceCount @results)
}}</TableHeader>
<TableHeader @size="wide">{{t "pages.assessment-individual-results.table.column.results.label"}}</TableHeader>
</tr>
</thead>

{{#if (displayResults @results)}}
<tbody>
{{#each (sortedCompetenceResults @results) as |competenceResult|}}
<tr aria-label={{t "pages.assessment-individual-results.table.row-title"}}>
<td class="competences-col__name">
<span class="competences-col__border competences-col__border--{{competenceResult.areaColor}}"></span>
<span>
{{competenceResult.name}}
</span>
</td>
<td class="competences-col__gauge">
<PixProgressBar
@value={{multiply competenceResult.competenceMasteryRate 100}}
@tooltipText={{t
"pages.assessment-individual-results.table.column.results.tooltip"
result=competenceResult.competenceMasteryRate
competence=competenceResult.name
htmlSafe=true
}}
/>
</td>
</tr>
{{/each}}
</tbody>
{{/if}}
</table>

{{#unless (displayResults @results)}}
<p class="table__empty content-text">{{t "pages.assessment-individual-results.table.empty"}}</p>
{{/unless}}
</section>
</template>
47 changes: 0 additions & 47 deletions orga/app/components/participant/assessment/results.hbs

This file was deleted.

6 changes: 4 additions & 2 deletions orga/app/components/tube/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ export default class TubeList extends Component {
@action
selectTube(tube) {
if (this.isTubeSelected(tube)) return;
this.selectedTubeIds.pushObject(tube.id);
this.selectedTubeIds = [...this.selectedTubeIds, tube.id];
}

@action
unselectTube(tube) {
const index = this.selectedTubeIds.indexOf(tube.id);
if (index === -1) return;
this.selectedTubeIds.removeAt(index);
this.selectedTubeIds.splice(index, 1);

this.selectedTubeIds = [...this.selectedTubeIds];
}

getThematicState = (thematic) => {
Expand Down
4 changes: 0 additions & 4 deletions orga/app/models/campaign-assessment-participation-result.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@ export default class CampaignAssessmentParticipationResult extends Model {
inverse: 'campaignAssessmentParticipationResult',
})
competenceResults;

get sortedCompetenceResults() {
return this.hasMany('competenceResults').value().sortBy('index');
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import Route from '@ember/routing/route';

export default class ResultsRoute extends Route {
model() {
async model() {
const { campaignAssessmentParticipation } = this.modelFor('authenticated.campaigns.participant-assessment');
return campaignAssessmentParticipation;
const campaignAssessmentParticipationResult =
await campaignAssessmentParticipation.campaignAssessmentParticipationResult;
const competenceResults = await campaignAssessmentParticipationResult.competenceResults;

return competenceResults.slice(0);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{{page-title this.pageTitle}}

<Participant::Assessment::Results
@results={{@model.campaignAssessmentParticipationResult}}
@displayResults={{gt @model.campaignAssessmentParticipationResult.sortedCompetenceResults.length 0}}
@class="participant-results"
/>
<Participant::Assessment::Results @results={{@model}} @class="participant-results" />
4 changes: 0 additions & 4 deletions orga/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ module.exports = function (environment) {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false,
},
},

APP: {
Expand Down
Loading

0 comments on commit c87594c

Please sign in to comment.