From ada7ef4c37d5a510e0d859349531f542e7175831 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Mon, 13 May 2024 23:14:17 -0400 Subject: [PATCH] Fix subscription period selector --- figures/interactive/top_recommendations.html | 35 ++++++-------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/figures/interactive/top_recommendations.html b/figures/interactive/top_recommendations.html index bbd2528..66f8232 100644 --- a/figures/interactive/top_recommendations.html +++ b/figures/interactive/top_recommendations.html @@ -66,8 +66,7 @@ display: inline-block; width: 15px; height: 15px; - margin-right: 2px; - margin-top: 2px; + margin: 2px 2px 0; } .swatch.period1921::before { background-color:#1f77b4; @@ -132,27 +131,15 @@

Top Recommendations

- - Subscription period: + @@ -300,11 +287,11 @@

Collaborative Filtering Methods

currentCF = currentCF.filter((x) => selectedIds.includes(x.item_id)); } - const selectedSubs = Array.from(periodInput).filter((elem) => elem.checked).map((elem) => elem.value); - // TODO: what about no selection? - if (selectedSubs.length == 1) { - currentLenskit = currentLenskit.filter((x) => x.period.startsWith(selectedSubs[0])); - currentCF = currentCF.filter((x) => x.period.startsWith(selectedSubs[0])); + // optionally filter by subscription time period + const selectedSubs = document.querySelector('input[name="subscription"]:checked').value; + if (selectedSubs != "both") { + currentLenskit = currentLenskit.filter((x) => x.period.startsWith(selectedSubs)); + currentCF = currentCF.filter((x) => x.period.startsWith(selectedSubs)); } plotLenskitData(currentLenskit);