gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchl33-thinecd7e226|||PR Consolidate login and move handler logic into topic libraries (partial)mrel33-thin/tests/purge94-count.hl

1.8 KB

  1. // tests/purge94-count.hl — counts per table of one ticket (by id only, never a text) for tests/purge94.mjs. Args: <ticket @id>. Prints one JSON line.
  2. import { args } from 'hl:proc'
  3. import { exists } from 'hl:fs'
  4. import { ticketsTable, linksTable } from '../lib/tickets.hl'
  5. import { eventsTable } from '../lib/events.hl'
  6. import { streamTable } from '../lib/stream.hl'
  7. import { changesTable, likesTable } from '../lib/comments.hl'
  8. import { attachmentsTable, filesDir } from '../lib/attachments.hl'
  9. import { countOf } from '../lib/util.hl'
  10. id = args()[0]
  11. evs = eventsTable.find('ticket', id)
  12. seen = {}
  13. if (countOf(evs) > 0) { for (e of evs) { seen[e.id] = true } }
  14. let other = 0
  15. for (e of eventsTable.find(null, null)) { if (e.kind == 'link' && e.ticket != id && (e.other == id || e.previous == id)) { other = other + 1 } }
  16. let st = 0
  17. let blank = 0
  18. for (r of streamTable.iterate(null, null)) {
  19. if (r.ticket == id || seen[r.event] == true) { st = st + 1 }
  20. if (r.kind == 'purged') { blank = blank + 1 }
  21. }
  22. let ch = 0
  23. for (r of changesTable.iterate(null, null)) { if (r.ticket == id || seen[r.event] == true) { ch = ch + 1 } }
  24. let lk = 0
  25. for (r of likesTable.iterate(null, null)) { if (r.ticket == id || seen[r.event] == true) { lk = lk + 1 } }
  26. let at = 0
  27. let files = 0
  28. for (a of attachmentsTable.iterate(null, null)) {
  29. if (a.ticket == id || seen[a.event] == true) {
  30. at = at + 1
  31. if (exists(filesDir + '/' + a.file)) { files = files + 1 }
  32. }
  33. }
  34. links = countOf(linksTable.find('ticket', id)) + countOf(linksTable.find('other', id))
  35. console.log('COUNTS ' + JSON.stringify({ tickets = ticketsTable.fetch(id) == null ? 0 : 1 events = countOf(evs) stream = st purgedStreamRows = blank commentChanges = ch commentLikes = lk attachments = at attachmentFiles = files links = links linkEventsOfOthers = other streamTotal = streamTable.count() }))

Branches

Latest commits

  • ecd7e226|||PR Consolidate login and move handler logic into topic libraries (partial)mre
  • 6dea1c60Merge branch 'r35-day72' into mainTickets
  • 7bcfdc22|||PR drop worker edits to conductor recordsmre
  • 2617b6ee|||PR dialogs: host flag cleared on close, dialog gate (tickets#40)mre
  • 6e701371|||PR record partial day72 dialog validationmre
  • b9fb9a91|||PR bind ticket dialog visibility to member flagsmre
  • 0788e65f|||PR re-vendor Hybriel day72mre
  • e2a6bdcfMerge branch 'records-t35' into mainTickets
  • d8d54df1|||PR records: R35 day72 + #40mre
  • 8a7f475aMerge branch 'records-t33' into mainTickets
  • e685d0c2|||PR records: PROCEDURES merge callmre
  • b42aff2b|||PR records: GO 2026-11-23, workers L33 O34, PROCEDURES.mdmre
  • ed091d44Merge branch 'records' into mainTickets
  • 180c0cdb|||PR records: ticket move live (M32), hybriel#439mre
  • 497cae7bMerge branch 'm32-move' into mainTickets
  • 772e0696|||PR Allow project admins to move tickets between their projectsmre
  • be92a560Merge branch 'records' into mainTickets
  • 0daf2ea8|||PR records: PR-only workflow, #50 donemre
  • 0185d0b6Log PR 1 deploymre
  • f5bf16e2Mission 031: deploy PR 1mre