File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,8 @@ class JSONSession:
6868
6969 def refresh (self , path : Path ) -> bool :
7070 if path .exists () and path .stat ().st_mtime_ns > self .modified :
71- self .data = self ._diff (self ._load (path )["data" ])
71+ self .data = self ._diff (self ._load (path )["data" ], path .stat ().st_mtime_ns )
72+ self .modified = path .stat ().st_mtime_ns
7273 return True
7374 return False
7475
@@ -87,7 +88,7 @@ def commit(self, path: Path) -> None:
8788
8889 self .modified = path .stat ().st_mtime_ns
8990
90- def _diff (self , comp : list [TogglClass ]) -> list [TogglClass ]:
91+ def _diff (self , comp : list [TogglClass ], mtime : int ) -> list [TogglClass ]:
9192 old_models = {m .id : m for m in self .data }
9293 new_models = {m .id : m for m in comp }
9394
@@ -104,7 +105,7 @@ def _diff(self, comp: list[TogglClass]) -> list[TogglClass]:
104105 new_data .append (old )
105106 elif new and old and new .timestamp >= old .timestamp :
106107 new_data .append (new )
107- elif old :
108+ elif old and old . timestamp . timestamp () * 10 ** 9 >= mtime :
108109 new_data .append (old )
109110
110111 return new_data
You can’t perform that action at this time.
0 commit comments