Commit caa9b6e5 authored by Florent Chehab's avatar Florent Chehab

Fixed scholarship front not displaying amounts

parent 73ec43f1
Pipeline #43280 passed with stages
in 7 minutes and 51 seconds
......@@ -298,8 +298,9 @@ class Filter extends CustomComponentForAPI {
componentDidUpdate(prevProps, prevState, snapshot) {
super.componentDidUpdate(prevProps, prevState, snapshot);
if (Filter.univHandler){ // make sure it has been initilized
if (Filter.univHandler){ // make sure it has been initialized elsewhere first
const mostRecentSemesters = this.univHandler.defaultSemesters;
// Set the default value for the filter
if (!Filter.hasBeenChanged) this.updateSelectedUniversities("semesters", mostRecentSemesters);
}
}
......
......@@ -62,8 +62,12 @@ class Scholarship extends React.Component {
getAmounts() {
const {amountMin, amountMax} = this.props;
if (amountMax != null && amountMax != amountMin) {
return `${amountMin}${this.getSymbol()}${amountMax}${this.getSymbol()}`;
if (amountMax != null && amountMax !== amountMin) {
if (amountMin === null) {
return `⩽ ${amountMax}${this.getSymbol()}`;
} else {
return `${amountMin}${this.getSymbol()}${amountMax}${this.getSymbol()}`;
}
} else {
return `${amountMin}${this.getSymbol()}`;
}
......@@ -79,34 +83,39 @@ class Scholarship extends React.Component {
return `Monnaie non reconnue: ${currency}`;
}
if (amountMax != null && amountMax != amountMin) {
return `${convertedMin}€ – ${this.convertAmountToEur(amountMax)}€`;
if (amountMax !== null && amountMax !== amountMin) {
if (amountMin === null) {
return `⩽ ${this.convertAmountToEur(amountMax)}€`;
} else {
return `${convertedMin}€ – ${this.convertAmountToEur(amountMax)}€`;
}
} else {
return `${convertedMin}€`;
}
}
renderFinancialAdvantage() {
const {amountMin, currency, classes} = this.props;
const {amountMin, amountMax, currency, classes} = this.props;
return (
<>
{
amountMin !== null ? (
amountMin !== null || amountMax !== null ?
<>
<Typography className={classes.item} variant='h5'> Avantage financier : </Typography>
<Typography className={classes.item} variant='h5'>Avantage financier :</Typography>
<Typography className={classes.textAmount}> {this.getAmounts()}{" "}{this.getFrequency()}</Typography>
{
currency != "EUR" ?
currency !== "EUR" ?
<Typography
variant='caption'><em>( {this.getConvertedAmounts()}{" "}{this.getFrequency()})</em></Typography>
:
<></>
}
</>
) : (
:
<Typography variant='caption'><em>Aucun avantage financier est notifié.</em></Typography>
)
}
</>
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment