Skip to content

Commit

Permalink
Merge pull request #63 from brmnjsh/61-min-max-grade-set-to-undefined…
Browse files Browse the repository at this point in the history
…-after-returning-to-filter-selection

Issue 61: Set min and max grades during submit
  • Loading branch information
lemeryfertitta committed May 3, 2024
2 parents 3496f7a + c4f12cf commit 16eddb6
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions climbdex/static/js/filterSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,14 @@ function createSlider() {

mergeTooltips(arbitraryValuesSlider, 10, " - ");

// Update hidden values with slider values
slider.on("update", function (values, handle) {
document.getElementById("slider-minValue").value = values[0];
document.getElementById("slider-maxValue").value = values[1];
});

// Convert slider values to numeric difficulty before form submit
// Get Slider values and convert slider values to numeric difficulty before form submit
document
.getElementById("form-search")
.addEventListener("submit", function (e) {
e.preventDefault();
const minGradeValue = document.getElementById("slider-minValue").value;
const maxGradeValue = document.getElementById("slider-maxValue").value;
const values = slider.get()
const minGradeValue = values[0];
const maxGradeValue = values[1];
const convertedMinGrade = gradeMapping[minGradeValue];
const convertedMaxGrade = gradeMapping[maxGradeValue];
document.getElementById("slider-minValue").value = convertedMinGrade;
Expand Down

0 comments on commit 16eddb6

Please sign in to comment.