♻️ 书源 id 去掉 ext. 前缀,沿用旧内置源数据
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
1 parent
1698ed8412
commit
c029847ffd
10 files changed
+23
-23
No files matched your search
+12
-12
@@ -36,22 +36,22 @@ wire.data.user.readingTimeHistory[2].readingTime.duration = -1
|
||||
Assert.is_nil(Mapper.readingStats(wire, "2026-10-09", now))
|
||||
wire.data.user.readingTimeHistory[2].readingTime.duration = 1200
|
||||
|
||||
Assert.is_true(StatsDB.removeSource("ext.douban"))
|
||||
Assert.is_true(StatsDB.removeSource("douban"))
|
||||
Assert.is_true(StatsDB.add({
|
||||
source_id = "ext.douban", stable_id = "test-book", record_type = "page",
|
||||
source_id = "douban", stable_id = "test-book", record_type = "page",
|
||||
start_time = now - 600, duration = 60, page = 1, total_pages = 10,
|
||||
}, StatsDB.PENDING))
|
||||
Assert.is_true(StatsDB.replaceSynced("ext.douban", snapshot.replace, snapshot.rows) ~= nil)
|
||||
Assert.eq(StatsDB.summaryBySource("ext.douban").total_seconds, 7260)
|
||||
Assert.eq(StatsDB.dailyBySource("ext.douban")[2].seconds, 1260)
|
||||
Assert.eq(#StatsDB.unsyncedBySource("ext.douban", 200), 1)
|
||||
Assert.is_true(StatsDB.replaceSynced("ext.douban", snapshot.replace, snapshot.rows) ~= nil)
|
||||
Assert.eq(StatsDB.summaryBySource("ext.douban").total_seconds, 7260)
|
||||
Assert.is_true(StatsDB.replaceSynced("douban", snapshot.replace, snapshot.rows) ~= nil)
|
||||
Assert.eq(StatsDB.summaryBySource("douban").total_seconds, 7260)
|
||||
Assert.eq(StatsDB.dailyBySource("douban")[2].seconds, 1260)
|
||||
Assert.eq(#StatsDB.unsyncedBySource("douban", 200), 1)
|
||||
Assert.is_true(StatsDB.replaceSynced("douban", snapshot.replace, snapshot.rows) ~= nil)
|
||||
Assert.eq(StatsDB.summaryBySource("douban").total_seconds, 7260)
|
||||
wire.data.user.readingTimeHistory[1].readingTime.duration = 0
|
||||
snapshot = Mapper.readingStats(wire, "2026-10-09", now)
|
||||
Assert.is_true(StatsDB.replaceSynced("ext.douban", snapshot.replace, snapshot.rows) ~= nil)
|
||||
Assert.eq(#StatsDB.dailyBySource("ext.douban"), 1)
|
||||
Assert.eq(StatsDB.summaryBySource("ext.douban").total_pages, 1)
|
||||
Assert.is_true(StatsDB.replaceSynced("douban", snapshot.replace, snapshot.rows) ~= nil)
|
||||
Assert.eq(#StatsDB.dailyBySource("douban"), 1)
|
||||
Assert.eq(StatsDB.summaryBySource("douban").total_pages, 1)
|
||||
|
||||
local request
|
||||
package.preload["utils.settings"] = function()
|
||||
@@ -79,4 +79,4 @@ Assert.eq(payload.variables.userId, "42")
|
||||
Assert.is_true(payload.variables.beginDate:match("^%d%d%d%d%-%d%d%-%d%d$") ~= nil)
|
||||
Assert.eq(request.headers["X-CSRF-Token"], "test")
|
||||
Assert.eq(payload.extensions.persistedQuery.sha256Hash, Mapper.READING_TIME_HASH)
|
||||
StatsDB.removeSource("ext.douban")
|
||||
StatsDB.removeSource("douban")
|
||||
Reference in new issue
Block a user