hark: new boxing refinement

This commit is contained in:
Liam Fitzgerald 2021-05-18 10:57:25 +10:00
parent 55ad8e22ae
commit 4babfb22b7
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
3 changed files with 13 additions and 16 deletions

View File

@ -260,16 +260,14 @@
^- update:store
:- %more
^- (list update:store)
:+ give-unreads
[%set-dnd dnd]
give-notifications
:~ give-unreads
[%set-dnd dnd]
give-notifications
==
::
++ give-notifications
^- (list update:store)
%+ turn ~(tap by unread-notes)
|= [=index:store =notification:store]
^- update:store
[%added index notification]
[%timebox ~ ~(tap by unread-notes)]
::
++ give-since-unreads
^- (list [stats-index:store stats:store])
@ -322,8 +320,7 @@
?:(is-archive archive notifications)
|= [time=@da =timebox:store]
^- update:store
:^ %timebox time is-archive
~(tap by timebox)
[%timebox `time ~(tap by timebox)]
==
::
++ on-poke
@ -550,7 +547,7 @@
=. unreads-count (~(put by unreads-count) stats-index 0)
=/ times=(list index:store)
(unread-for-stats-index stats-index)
=? timeboxes !(~(has by timeboxes) stats-index) ~& 'new box' (~(put by timeboxes) stats-index now.bowl)
=? timeboxes !(~(has by timeboxes) stats-index) (~(put by timeboxes) stats-index now.bowl)
(give:(read-indices times) %read-count stats-index)
::
++ read-indices

View File

@ -502,11 +502,10 @@
==
::
++ timebox
|= [tim=@da arch=? l=(list [^index ^notification])]
|= [tim=(unit @da) l=(list [^index ^notification])]
^- json
%- pairs
:~ time+s+(scot %ud tim)
archive+b+arch
:~ time+`json`?~(tim ~ s+(scot %ud u.tim))
:- %notifications
^- json
:- %a

View File

@ -31,11 +31,12 @@
::
+$ action
$% [%add-note =index =notification]
[%archive time=(unit @da) index]
:: if .time is ~, then archiving unread notification
:: else, archiving read notification
[%archive time=(unit @da) =index]
::
[%unread-count =stats-index =time]
[%read-count =stats-index]
::
::
[%unread-each =stats-index ref=index:graph-store time=@da]
[%read-each =stats-index ref=index:graph-store]
@ -71,7 +72,7 @@
[%more more=(list update)]
[%added =index =notification]
[%note-read =time =index]
[%timebox time=@da archived=? =(list [index notification])]
[%timebox time=(unit @da) =(list [index notification])]
[%count count=@ud]
[%clear =stats-index]
[%unreads unreads=(list [stats-index stats])]