[FIXUP] Use attrset to store news ids

Avoid the quadratic complexity of looking up every news item in a list
of (almost) every news item.
This commit is contained in:
Robert Helgesson 2017-09-04 22:45:28 +02:00
parent 722c8b2363
commit 4cab2c21ab
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -21,10 +21,14 @@ let
newsReadIds = newsReadIds =
if newsReadIdsFile == null if newsReadIdsFile == null
then [] then {}
else splitString "\n" (fileContents newsReadIdsFile); else
let
ids = splitString "\n" (fileContents newsReadIdsFile);
in
builtins.listToAttrs (map (id: { name = id; value = null; }) ids);
newsIsRead = entry: builtins.elem entry.id newsReadIds; newsIsRead = entry: builtins.hasAttr entry.id newsReadIds;
newsFiltered = newsFiltered =
let let