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 ^- update:store
:- %more :- %more
^- (list update:store) ^- (list update:store)
:+ give-unreads :~ give-unreads
[%set-dnd dnd] [%set-dnd dnd]
give-notifications give-notifications
==
:: ::
++ give-notifications ++ give-notifications
^- (list update:store)
%+ turn ~(tap by unread-notes)
|= [=index:store =notification:store]
^- update:store ^- update:store
[%added index notification] [%timebox ~ ~(tap by unread-notes)]
:: ::
++ give-since-unreads ++ give-since-unreads
^- (list [stats-index:store stats:store]) ^- (list [stats-index:store stats:store])
@ -322,8 +320,7 @@
?:(is-archive archive notifications) ?:(is-archive archive notifications)
|= [time=@da =timebox:store] |= [time=@da =timebox:store]
^- update:store ^- update:store
:^ %timebox time is-archive [%timebox `time ~(tap by timebox)]
~(tap by timebox)
== ==
:: ::
++ on-poke ++ on-poke
@ -550,7 +547,7 @@
=. unreads-count (~(put by unreads-count) stats-index 0) =. unreads-count (~(put by unreads-count) stats-index 0)
=/ times=(list index:store) =/ times=(list index:store)
(unread-for-stats-index stats-index) (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) (give:(read-indices times) %read-count stats-index)
:: ::
++ read-indices ++ read-indices

View File

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

View File

@ -31,11 +31,12 @@
:: ::
+$ action +$ action
$% [%add-note =index =notification] $% [%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] [%unread-count =stats-index =time]
[%read-count =stats-index] [%read-count =stats-index]
::
:: ::
[%unread-each =stats-index ref=index:graph-store time=@da] [%unread-each =stats-index ref=index:graph-store time=@da]
[%read-each =stats-index ref=index:graph-store] [%read-each =stats-index ref=index:graph-store]
@ -71,7 +72,7 @@
[%more more=(list update)] [%more more=(list update)]
[%added =index =notification] [%added =index =notification]
[%note-read =time =index] [%note-read =time =index]
[%timebox time=@da archived=? =(list [index notification])] [%timebox time=(unit @da) =(list [index notification])]
[%count count=@ud] [%count count=@ud]
[%clear =stats-index] [%clear =stats-index]
[%unreads unreads=(list [stats-index stats])] [%unreads unreads=(list [stats-index stats])]