[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:
parent
722c8b2363
commit
4cab2c21ab
|
@ -21,10 +21,14 @@ let
|
|||
|
||||
newsReadIds =
|
||||
if newsReadIdsFile == null
|
||||
then []
|
||||
else splitString "\n" (fileContents newsReadIdsFile);
|
||||
then {}
|
||||
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 =
|
||||
let
|
||||
|
|
Loading…
Reference in a new issue