File

src/app/models/exercice-chapter-history.ts

Methods

maxStarsWon
maxStarsWon()
Returns: { star: number; total: number; ratio: number; }

Properties

bilan
bilan: boolean
chapterId
chapterId: string
id
id: string
idExercice
idExercice: string
position
position: number
results
results: { shooting: number; star: number; moon: number; }[]
tempId
tempId: string
export class ExerciceChapterHistory {
	id: string;
	chapterId: string;
	position: number;
	idExercice: string;
	bilan : boolean;
	tempId:string;
	results: { shooting: number; star: number; moon: number }[];

	maxStarsWon(): { star: number; total: number; ratio: number } {
		const result = { star: 0, total: 0, ratio: 0 };
		if (this.results && this.results.length > 0) {
			this.results.forEach(item => {
				const total = item.star + item.shooting + item.moon;
				const star = item.star + item.shooting;
				const ratio = star / total;
				if (ratio > result.ratio) {
					result.star = star;
					result.total = total;
					result.ratio = ratio;
				}
			});
		}
		return result;
	}
}

results matching ""

    No results matching ""