Skip to content

Commit

Permalink
https://github.com/ilri/OpenRXV/issues/51
Browse files Browse the repository at this point in the history
  • Loading branch information
ShacMiester committed Feb 1, 2021
1 parent eaedd0f commit 77cebae
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions frontend/src/app/explorer/filters/range/range.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ export class RangeComponent extends ParentComponent implements OnInit {
this.subToOrOperator();
this.subtoToQuery(source);
}

slidermin
slidermax
onYearSliderChange(): void {
const [min, max] = this.range;
[this.slidermin, this.slidermax] = [min, max]
const query: bodybuilder.Bodybuilder = this.rangeService.addAttributeToMainQuery(
{
gte: min,
Expand Down Expand Up @@ -136,7 +138,7 @@ export class RangeComponent extends ParentComponent implements OnInit {
});
}

private async getYears(caller?: ResetCaller, force: boolean = false) {
private async getYears(caller?: ResetCaller, force: boolean = false) {
return await new Promise((resolve, reject) => {


Expand All @@ -150,12 +152,13 @@ export class RangeComponent extends ParentComponent implements OnInit {
)
.subscribe(
(n: number[]) => {
n.length
? this.setMinMaxLogic(+n[n.length - 1], +n[0])
: this.noYearQuery() // some queries will return empty array

// some queries will return empty array

resolve();

resolve(n.length
? this.setMinMaxLogic(+n[n.length - 1], +n[0])
: this.noYearQuery());
}
);
})
Expand All @@ -176,7 +179,7 @@ export class RangeComponent extends ParentComponent implements OnInit {
}
this.max = max;
this.setFirstMinMax(max, min);
this.range = [min, max];
this.range = [this.slidermin >= min? this.slidermin : min, this.slidermax <= max? this.slidermax : max];

}

Expand Down

0 comments on commit 77cebae

Please sign in to comment.