[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 =
|
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
|
||||||
|
|
Loading…
Reference in a new issue