diff --git a/src/components/views/Result.jsx b/src/components/views/Result.jsx index b579564..b47cdaf 100644 --- a/src/components/views/Result.jsx +++ b/src/components/views/Result.jsx @@ -11,7 +11,7 @@ import { CardBody, Table, } from 'reactstrap'; -import {grades, i18nGrades} from '../../Util'; +import {i18nGrades} from '../../Util'; import {AppContext} from '../../AppContext'; import {errorMessage, Error} from '../../Errors'; @@ -166,8 +166,8 @@ class Result extends Component { render() { const {errorMessage, candidates, electionGrades} = this.state; const {t} = this.props; - const offsetGrade = grades.length-(this.state.numGrades); const i18nGradesObject = i18nGrades(); + const offsetGrade = i18nGradesObject.length-(this.state.numGrades); if (errorMessage && errorMessage !== '') { @@ -203,6 +203,7 @@ class Result extends Component {
    {candidates.map((candidate, i) => { + const gradeValue=candidate.grade+offsetGrade; return (
  1. {candidate.name} @@ -212,7 +213,7 @@ class Result extends Component { backgroundColor: electionGrades.slice(0).reverse()[(candidate.grade)].color, color: '#fff', }}> - {i18nGradesObject.slice(0).reverse()[candidate.grade+offsetGrade].label} + {i18nGradesObject.slice(0).reverse()[gradeValue].label} {/* {(100 * candidate.score).toFixed(1)}% diff --git a/src/components/views/Vote.jsx b/src/components/views/Vote.jsx index b65810f..793ed5c 100644 --- a/src/components/views/Vote.jsx +++ b/src/components/views/Vote.jsx @@ -6,7 +6,7 @@ import {toast, ToastContainer} from 'react-toastify'; import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; import {faCheck} from '@fortawesome/free-solid-svg-icons'; import {resolve} from 'url'; -import {i18nGrades,grades} from '../../Util'; +import {i18nGrades} from '../../Util'; import {AppContext} from '../../AppContext'; import {errorMessage} from '../../Errors'; @@ -169,7 +169,7 @@ class Vote extends Component { render() { const {t} = this.props; const {redirectTo, candidates, electionGrades} = this.state; - const offsetGrade = grades.length-this.state.numGrades; + const offsetGrade = i18nGrades().length-this.state.numGrades; if (redirectTo) { return ; @@ -222,6 +222,7 @@ class Vote extends Component { {this.state.electionGrades.map((grade, gradeId) => { console.assert(gradeId < this.state.numGrades) + const gradeValue = grade.value-offsetGrade; return (