summaryrefslogtreecommitdiff
path: root/elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2022-10-16 15:24:02 +0200
committerYorhel <git@yorhel.nl>2022-10-16 15:24:02 +0200
commitbefd849e8b7869d6bf176a178ca1e9e4650406f4 (patch)
treed1677bccd7ee57f9800c93621405ec33f940e7fb /elm
parent9fbc8d6accd8f8b9bb98e4a58c1673bd1416fe67 (diff)
VN::Edit: Match all known release titles in alias check
Diffstat (limited to 'elm')
-rw-r--r--elm/VNEdit.elm7
1 files changed, 4 insertions, 3 deletions
diff --git a/elm/VNEdit.elm b/elm/VNEdit.elm
index 99bf6ea6..34ee8639 100644
--- a/elm/VNEdit.elm
+++ b/elm/VNEdit.elm
@@ -78,6 +78,7 @@ type alias Model =
, scrUplNum : Maybe Int
, scrId : Int -- latest used internal id
, releases : List GVE.RecvReleases
+ , reltitles : List { id: String, title: String }
, chars : List GVE.RecvChars
, id : Maybe String
, dupCheck : Bool
@@ -116,6 +117,7 @@ init d =
, scrUplNum = Nothing
, scrId = 100
, releases = d.releases
+ , reltitles = d.reltitles
, chars = d.chars
, id = d.id
, dupCheck = False
@@ -362,11 +364,10 @@ update msg model =
-- TODO: Fuzzier matching? Exclude stuff like 'x Edition', etc.
--- TODO: Match on all titles associated with a release, not just the 'title' and 'alttitle'.
-relAlias : Model -> Maybe GVE.RecvReleases
+relAlias : Model -> Maybe { id: String, title: String }
relAlias model =
let a = String.toLower model.alias |> String.lines |> List.filter (\l -> l /= "") |> Set.fromList
- in List.filter (\r -> Set.member (String.toLower r.title) a || Set.member (String.toLower r.alttitle) a) model.releases |> List.head
+ in List.filter (\r -> Set.member (String.toLower r.title) a) model.reltitles |> List.head
isValid : Model -> Bool