Reading activity grid in Settings: months, weeks, days, hours with drill-down
Active reader time is now kept per user in small UTC buckets (6 minutes for 120 days, then hours, dropped after three years), seeded once from the visits the clock still remembers. Settings -> Reading activity shows them as a grid whose cells glow with their total and carry a start-to-end strip; month/week cells open their days, days open their hours. Finished chapters come from progress and work without the clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c760141636
commit
fe8956087e
15 files changed
+657
-4
No files matched your search
@@ -148,6 +148,15 @@ test('three services integrate collections, auth, custom covers and private heal
|
||||
assert.equal((await send(visit(first, 'beacon-first', 2, { activeMs: 500, seen: [0], final: true, release: true }))).accepted, true);
|
||||
assert.equal((await send(visit(second, 'third-visit', 1))).accepted, false);
|
||||
await send(visit(second, 'second-visit', 2, { release: true }));
|
||||
// The activity grid gets every credited millisecond once, duplicates and stale pulses excluded.
|
||||
assert.equal((await request('/api/progress', { m: first.manga.id, c: first.chapter.id, v: first.version, p: 0, n: 1, done: true })).status, 200);
|
||||
const activity = await (await request('/api/reading/activity')).json();
|
||||
assert.equal(activity.readingClock, true);
|
||||
assert.equal(activity.buckets.reduce((sum, b) => sum + b[2], 0), 2000);
|
||||
assert.deepEqual(activity.mangas.map(m => m.id), [first.manga.id]);
|
||||
assert.equal(activity.done.length, 1); assert.equal(activity.done[0][2], first.chapter.label);
|
||||
assert.equal((await request('/api/reading/delete', { m: first.manga.id })).status, 200);
|
||||
assert.equal((await (await request('/api/reading/activity')).json()).buckets.length, 0);
|
||||
assert.equal((await fetch(base + '/api/reading/visit', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(visit(first, 'unauth-visit', 1)) })).status, 401);
|
||||
await request('/api/settings', { readingClock: false });
|
||||
assert.equal((await request('/api/reading/visit', visit(first, 'disabled-visit', 1))).status, 403);
|
||||
|
||||
Reference in new issue
Block a user