diff --git a/src/app/compos/results/results.component.html b/src/app/compos/results/results.component.html index e53b402..6c2dc6e 100644 --- a/src/app/compos/results/results.component.html +++ b/src/app/compos/results/results.component.html @@ -3,14 +3,16 @@

Les résultats sont classés du plus conseillé au moins conseillé.

+

Les résultats moins conseillés apparaissant en rouge ne sont pas forcément contre-indiqués.

+

Les indices de Pearl (IP) des différentes contraceptions sont notés sous la forme “IP théorique/pratique”, dans l’ordre des différentes contraceptions si plusieurs sont mentionnées dans la phrase.

Cliquez sur un traitement pour plus d'information.

Conseils

-
-
+
{{r.treatment.label}} ({{ r.score }})
diff --git a/src/app/compos/results/results.component.ts b/src/app/compos/results/results.component.ts index 37cb53c..b442857 100644 --- a/src/app/compos/results/results.component.ts +++ b/src/app/compos/results/results.component.ts @@ -34,14 +34,20 @@ export class ResultsComponent implements OnInit { this.currentDetailsCode = null; } - computeScoreColor = (score: number) => { - if(score < 0){ - return "#d3274f"; - }else if (score < 1){ - return "#e8bb02"; - }else { + computeScoreColor = (score: number, index: number) => { + if (index < 2){ + // first two indexes are always displayed in green return "#3fa58f"; + }else{ + if(score < 0){ + return "#d3274f"; + }else if (score < 1){ + return "#e8bb02"; + }else { + return "#3fa58f"; + } } + } hasResults = () => this.recommendations.length > 0 || this.discouragements.length > 0; diff --git a/src/app/pages/page-home/page-home.component.html b/src/app/pages/page-home/page-home.component.html index 28bac4b..616f10d 100644 --- a/src/app/pages/page-home/page-home.component.html +++ b/src/app/pages/page-home/page-home.component.html @@ -21,6 +21,8 @@

Vous disposez également d'un onglet "CONTRE-INDICATIONS" que vous pouvez consulter pour étayer votre choix.

+ + Victoria Allal
diff --git a/src/app/pages/page-home/page-home.component.scss b/src/app/pages/page-home/page-home.component.scss index 5db06d5..7395162 100644 --- a/src/app/pages/page-home/page-home.component.scss +++ b/src/app/pages/page-home/page-home.component.scss @@ -30,3 +30,10 @@ p { display: flex; justify-content: center; } + +.signature { + display: block; + text-align: right; + width: 100%; + font-size: 1.4em; +} diff --git a/src/app/services/answers.service.ts b/src/app/services/answers.service.ts index a050939..03b4fbc 100644 --- a/src/app/services/answers.service.ts +++ b/src/app/services/answers.service.ts @@ -11,12 +11,10 @@ export class AnswersService { addAnswer = (answerIndex: string) => { this.answersIndexes.push(answerIndex); - console.log(this.answersIndexes); } removeAnswer = (answerIndex: string) => { this.answersIndexes.splice(this.answersIndexes.indexOf(answerIndex), 1); - console.log(this.answersIndexes); } resetAnswers = () => { diff --git a/src/app/services/engine.service.ts b/src/app/services/engine.service.ts index e20784a..d43082f 100644 --- a/src/app/services/engine.service.ts +++ b/src/app/services/engine.service.ts @@ -42,7 +42,6 @@ export class EngineService { discouraged: row[3].replace('\r', '').replace('_', '').split('') }; } - console.log('Outcomes loaded', this.OUTCOMES_MAP); }); }; diff --git a/src/app/services/treatments.service.ts b/src/app/services/treatments.service.ts index 0b224d8..18b642a 100644 --- a/src/app/services/treatments.service.ts +++ b/src/app/services/treatments.service.ts @@ -64,7 +64,6 @@ export class TreatmentsService { .subscribe((data) => { let rows = data.split("\n"); - let currentSectionType: SectionType | null = null; let currentSection: Section | null = null; let currentTreatmentDetails: TreatmentDetails | null = null; @@ -75,55 +74,50 @@ export class TreatmentsService { return; } - if(isSectionLine(row)){ - // new section starts - currentSectionType = getSectionType(row); + if(isSectionLine(row)) { + // new section starts: push previous section into its treatment + if(currentTreatmentDetails && currentSection){ + currentTreatmentDetails?.sections.push(currentSection); + } + + const currentSectionType = getSectionType(row); if(currentSectionType === "info"){ - // new treatment starts - - // push previous treatment if exists + // a new treatment starts, push previous into treatment list if(currentTreatmentDetails){ this.TREATMENT_DETAILS.push(currentTreatmentDetails); } - // init next treatment + // init new treatment currentTreatmentDetails = { treatment: parseTreatmentInfo(row), sections: [] - }; - - }else{ - // new free or formatted section starts - - // push previous section if exists - if(currentSection){ - if(currentTreatmentDetails){ - currentTreatmentDetails.sections.push(currentSection) - }else{ - throw new Error(`Tried to push section in a non existing treatment: ${currentSection}`); - } } + // current section reset + currentSection = null; + }else if (currentSectionType === "formatted" || currentSectionType === "free"){ + // formatted section starts, init new section currentSection = { type: currentSectionType, title: parseSectionTitle(row, currentSectionType), rows: [] } } - - return; - } - - // new line of current section - if(currentSection){ - currentSection.rows.push(row.trim()); }else{ - throw new Error(`Tried to push row without a section: ${row}`); + // new row of current section + if(currentSection){ + currentSection.rows.push(row.trim()); + }else{ + throw new Error(`Tried to push row without a section: ${row}`); + } } }); - console.log(this.TREATMENT_DETAILS); + // push previous treatment (the last one) + if(currentTreatmentDetails){ + this.TREATMENT_DETAILS.push(currentTreatmentDetails); + } }); }