gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit90734c6c90734c6cMerge branch 'hm60-shortids'mre90734c6c/tests/seed-status.hl

4.4 KB

  1. // tests/seed-status.hl — GATE FIXTURE for tracker#35 (mission 030): written by tests/browser.mjs into the gate's storage while the
  2. // app is STOPPED (one process per storage, hybriel#21). Four complete series (synced: `tmdbSync`) with TMDB's status and a TVmaze
  3. // id but no TVmaze status yet — the status backfill (backfill.hl tvmazeStatusTitle) asks the fake TVmaze for each:
  4. // Running Gate Series TMDB 'Returning Series', TVmaze 5501 'Running' → pill "Returning" (green; mission 033: episodes 10
  5. // days ago and in 10 days — outside the ±7 days —
  6. // and a SPECIAL (season 0) in 2 days: no "Airing")
  7. // Airing Gate Series TMDB 'Returning Series', TVmaze 5503 'Running' → "Airing" (an episode in 3 days)
  8. // Aired Gate Series TMDB 'Returning Series', TVmaze 5505 'Running' → "Airing" (an episode 7 days ago: the edge)
  9. // Canceled Gate Series TMDB 'Canceled', TVmaze 5502 'Ended' → pill "Canceled" (red: TVmaze has no canceled)
  10. // Gone Maze Series TMDB 'Ended', TVmaze 5504 → 404 → `tvmazeStatusCheck`, pill "Ended" (muted)
  11. // Pending Gate Series TMDB 'In Production', no TVmaze id → never asked, pill "In Production" (yellow)
  12. // Variety Gate Series TMDB type 'Scripted' (a series), TVmaze 5506 'Running', type 'Variety' → #43 (mission 037): a SHOW
  13. // once TVmaze's type is stored — moves from /series to /shows (like Saturday Night Live UK)
  14. import { MPackDB } from 'hl:mpackdb'
  15. import { env } from 'hl:proc'
  16. import { now, timestamp } from 'hl:time'
  17. storageDir = env('TRACKER_STORAGE')
  18. if (storageDir == null || !storageDir.startsWith('/')) { hlError('set TRACKER_STORAGE, absolute') }
  19. showsTable = new MPackDB(file = storageDir + '/shows.db', primaryKey = '@id', indexes = ['!oldId'])
  20. seasonsTable = new MPackDB(file = storageDir + '/seasons.db', primaryKey = '@id', indexes = ['!oldId'])
  21. episodesTable = new MPackDB(file = storageDir + '/episodes.db', primaryKey = '@id', indexes = ['!oldId'])
  22. day = (n) => { return timestamp(now() + n * 86400000).slice(0, 10) }
  23. // a season with an episode per date (mission 033: Returning vs Airing); returns its id
  24. season = (showId, no, dates) => {
  25. sid = showId + 's' + no
  26. eps = []
  27. let k = 0
  28. while (k < dates.length) {
  29. let eid = sid + 'e' + k
  30. episodesTable.put({ id = eid episodeNumber = k + 1 seasonNumber = no title = 'Episode ' + (k + 1) summary = null release = dates[k] show = showId season = sid oldId = eid })
  31. eps.push(eid)
  32. k = k + 1
  33. }
  34. seasonsTable.put({ id = sid seasonNumber = no title = null release = null summary = null show = showId episodes = eps oldId = sid })
  35. return sid
  36. }
  37. series = (id, tmdbId, name, slug, status, tvmzId) => {
  38. return { adult = false id = id title = name summary = 'A #35 fixture.' tmdbSummary = null tmdbId = tmdbId
  39. language = 'en' type = 'series' kind = 'series' release = '2015-01-01' year = 2015 image = null urlSegment = slug
  40. episodesCount = 0 homepage = null imdbId = null seasonsCount = 0 status = status tagline = null
  41. tvdbId = null tvmzId = tvmzId genres = [] cast = [] seasons = [] oldId = 'st-' + tmdbId creditsAt = 1 detailsAt = 1 tmdbSync = 1 }
  42. }
  43. r1 = series('st00000000000sr1', 1501, 'Running Gate Series', 'running-gate-series', 'Returning Series', 5501)
  44. r1.seasons = [season(r1.id, 1, [day(-10), day(10)]), season(r1.id, 0, [day(2)])]
  45. showsTable.put(r1)
  46. a1 = series('st00000000000sr5', 1505, 'Airing Gate Series', 'airing-gate-series', 'Returning Series', 5503)
  47. a1.seasons = [season(a1.id, 1, [day(-30), day(3)])]
  48. showsTable.put(a1)
  49. a2 = series('st00000000000sr6', 1506, 'Aired Gate Series', 'aired-gate-series', 'Returning Series', 5505)
  50. a2.seasons = [season(a2.id, 1, [day(-7)])]
  51. showsTable.put(a2)
  52. showsTable.put(series('st00000000000sr2', 1502, 'Canceled Gate Series', 'canceled-gate-series', 'Canceled', 5502))
  53. showsTable.put(series('st00000000000sr4', 1504, 'Gone Maze Series', 'gone-maze-series', 'Ended', 5504))
  54. showsTable.put(series('st00000000000sr3', 1503, 'Pending Gate Series', 'pending-gate-series', 'In Production', null))
  55. v1 = series('st00000000000sr7', 1507, 'Variety Gate Series', 'variety-gate-series', 'Returning Series', 5506)
  56. v1.tmdbType = 'Scripted'
  57. showsTable.put(v1)
  58. seasonsTable.persist()
  59. episodesTable.persist()
  60. showsTable.persist()
  61. console.log('seed status: 7 series (TVmaze 5501, 5502, 5503, 5504, 5505, none, 5506)')

Branches

Latest commits

  • 90734c6cMerge branch 'hm60-shortids'mre
  • e0db0d1bHM60 report: tracker#60 packed short-ID ownersmre
  • 3c79b576Pack short-ID ownership into byte buffersmre
  • e822524bstatus wordingmre
  • 1c7f0480log: HM60/HM61 startedmre
  • 2841d215missions HM60 HM61mre
  • 289c6ce4HM1 report: heap object breakdownmre
  • 2e7d6257log: HM1 startedmre
  • 2f790465mission HM1: heap object breakdownmre
  • a18957falog: evening re-measure after CBmre
  • aac9a98dlog: evening re-measure startmre
  • 45163bd4log: person/tmdb error hypothesismre
  • cb38de2blog: swap 503 causemre
  • fd10c3d5log: CB livemre
  • 7557c025log: CB deploy try 2mre
  • 06a7534aMerge branch 'cb'mre
  • 2f8030d6log: CB gates greenmre
  • 498bf644log: CB gates startmre
  • f59c2847gc1: bound the five request caches (shows.hl cacheLimit)mre
  • 6ea2c6d6log: morning re-measure 11-04mre