Use correct category count in search menu

This commit is contained in:
Eike Kettner
2021-04-11 14:19:07 +02:00
parent 3e0914ece7
commit 39ed246a42
2 changed files with 35 additions and 59 deletions

View File

@ -92,7 +92,7 @@ type TextSearchModel
init : Flags -> Model
init flags =
{ tagSelectModel = Comp.TagSelect.init [] []
{ tagSelectModel = Comp.TagSelect.init [] [] [] []
, tagSelection = Comp.TagSelect.emptySelection
, directionModel =
Comp.Dropdown.makeSingleList
@ -483,7 +483,9 @@ updateDrop ddm flags settings msg model =
GetAllTagsResp (Ok stats) ->
let
tagSel =
Comp.TagSelect.modifyAll stats.tagCloud.items model.tagSelectModel
Comp.TagSelect.modifyAll stats.tagCloud.items
stats.tagCategoryCloud.items
model.tagSelectModel
in
{ model = { model | tagSelectModel = tagSel }
, cmd = Cmd.none
@ -500,9 +502,14 @@ updateDrop ddm flags settings msg model =
GetStatsResp (Ok stats) ->
let
selectModel =
tagCount =
List.sortBy .count stats.tagCloud.items
|> Comp.TagSelect.modifyCount model.tagSelectModel
catCount =
List.sortBy .count stats.tagCategoryCloud.items
selectModel =
Comp.TagSelect.modifyCount model.tagSelectModel tagCount catCount
model_ =
{ model