gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit5965963a5965963adeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre5965963a/components/schedule.hl

3.1 KB

  1. // components/schedule.hl — `/my/schedule` (tracker.worldapi.org#6, moved from `/schedule` in #8): every episode of a show the signed-in
  2. // user follows that is not yet released, soonest first. Creator's words: "/schedule has a similar list
  3. // without check icons for he upcoming episodes of shows followed". Same row shape as /unwatched (step 5)
  4. // minus the check icon and minus any click handling — this page is read-only, so it needs no `on server`
  5. // face at all. Reused (not copied) from follows.hl/shows.hl: `followedShowIds`, `cardOf`, `episodeRowsOf`
  6. // — the same functions /unwatched already imports.
  7. //
  8. // Upcoming = release date strictly AFTER today (the architect's reading of the ticket: "the creator named
  9. // the order only for /unwatched" — /unwatched is release <= today, so the natural complement here is
  10. // release > today; an episode releasing today already belongs to /unwatched once watched state is added).
  11. parent './main.hl'
  12. import { appTitle } from '../project.hl'
  13. import { userIdOfSession } from '../lib/users.hl'
  14. import { followedShowIds } from '../lib/follows.hl'
  15. import { cardOf, episodeRowsOf, episodeCode } from '../lib/shows.hl'
  16. import { todayStr } from '../lib/util.hl'
  17. // ---- pure helpers (static: an mpackdb-backed helper must be `static` to stay callable outside its
  18. // own initializer, hybriel#115/#116 — see components/unwatched.hl's header comment) --------------
  19. // insertion sort, hand-written (no list sort(), hybriel#1) — soonest release first
  20. static insertByReleaseAsc = (&sorted, &row) => {
  21. out = []
  22. let inserted = false
  23. for (x of sorted) {
  24. if (!inserted && row.release <= x.release) { out.push(row) inserted = true }
  25. out.push(x)
  26. }
  27. if (!inserted) { out.push(row) }
  28. return out
  29. }
  30. static scheduleRowsOf = (&userId) => {
  31. if (userId == null) { return [] }
  32. today = todayStr()
  33. let out = []
  34. // tracker#30 (mission 025): the slim cached card + episode rows per followed title (shows.hl), no record fetched per load
  35. for (sid of followedShowIds(userId)) {
  36. let c = cardOf(sid)
  37. if (c != null) {
  38. for (e of episodeRowsOf(sid)) {
  39. let upcoming = e.release != null && e.release > today
  40. if (upcoming) {
  41. out = insertByReleaseAsc(out, {
  42. id = e.id showTitle = c.titleYear showHref = c.href
  43. episodeLabel = episodeCode(e.s, e.e) + ' · ' + e.title
  44. release = e.release
  45. })
  46. }
  47. }
  48. }
  49. }
  50. return out
  51. }
  52. // ---- reactive members -----------------------------------------------------------------------
  53. session = null
  54. userId = userIdOfSession(session)
  55. signedIn = userId != null
  56. // a plain copy of userId for `rows` (mission 047: session sync, see components/show.hl `me`)
  57. me = userId
  58. rows = signedIn ? scheduleRowsOf(me) : []
  59. hasRows = rows.length > 0
  60. noRows = !hasRows
  61. emptyText = signedIn ? 'No upcoming episodes.' : 'Sign in to see the shows you follow.'
  62. __title = 'Schedule — ' + appTitle
  63. View {
  64. schedulePage {
  65. h1 { "Schedule" }
  66. if (noRows) { p { class = "muted" emptyText } }
  67. if (hasRows) {
  68. scheduleRows {
  69. for (row of rows) {
  70. scheduleRow {
  71. a { class = "schedule-show" href = row.showHref row.showTitle }
  72. scheduleEpisode { row.episodeLabel }
  73. scheduleDate { row.release }
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }

Branches

Latest commits

  • 5965963adeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
  • 9b3828aemission 046a: report, LOGmre
  • 4b37356emission 046: franchise seed supersedeCollections reads the curated timelines once (10 s one-tick block at the end of boot)mre
  • ac6268e3mission 046a: re-vendor Hybriel 528bc89f (integration 6): plugins mpackdb/time/web (bin/ git-ignored)mre
  • 322b3293mission 046: photoQueue guard for non-row fetch results (damaged persons index)mre
  • e5b99aecmission 046: photoQueue in slices (people.hl photoQueueStart/Step, jobs.hl photoTick), tests/photoqueue.hlmre
  • 31dcf2admission 045: report, LOGmre
  • 9c3971d0tests/persons-skip-count.hlmre
  • 4d72e365mission 045mre
  • b9cae4c9slices: skip and count non-row values from range(); merge persons pass falls back to iterate; guard testmre
  • 3db7dc31merge w44-jobs-slices into w43-trkmemmre
  • 593dab6fmission 043: report, LOGmre
  • 1a5a4818boot scans back to iterate (slices measured slower: titles 114 s, episodes 141 s, persons failed); lambda per rowmre
  • 03d29893boot scans read primary-key slices (lib/slices.hl from mission 044): iterate is eager too; people view log line back; allShows/allEpisodes stay for toolsmre
  • 23375c58mission 044: report, LOG, STATUSmre
  • c6fd928emission 044: 4096 slices for tables over 200 K rows, 15 ms budget, TRACKER_SLICE_DEPTH for testsmre
  • fb057680mission 044: jobs.hl imports mergeLeft (gate found it), mission file, slices benchmre
  • 0d6293ebmission 043: mission filemre
  • d25bd14amission 044: sliced merge prepare + sliced collections prepare; jobs-dump old/new check + bulk fixturemre
  • 633ee210mission 044: sliced table scans (slices.hl, pk-range slices) for the adult/kind/status/art/credits/details-repair queuesmre