tickets
All repositories: gitoria
1.8 KB
// 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.import { args } from 'hl:proc'import { exists } from 'hl:fs'import { ticketsTable, linksTable } from '../lib/tickets.hl'import { eventsTable } from '../lib/events.hl'import { streamTable } from '../lib/stream.hl'import { changesTable, likesTable } from '../lib/comments.hl'import { attachmentsTable, filesDir } from '../lib/attachments.hl'import { countOf } from '../lib/util.hl'id = args()[0]evs = eventsTable.find('ticket', id)seen = {}if (countOf(evs) > 0) { for (e of evs) { seen[e.id] = true } }let other = 0for (e of eventsTable.find(null, null)) { if (e.kind == 'link' && e.ticket != id && (e.other == id || e.previous == id)) { other = other + 1 } }let st = 0let blank = 0for (r of streamTable.iterate(null, null)) {if (r.ticket == id || seen[r.event] == true) { st = st + 1 }if (r.kind == 'purged') { blank = blank + 1 }}let ch = 0for (r of changesTable.iterate(null, null)) { if (r.ticket == id || seen[r.event] == true) { ch = ch + 1 } }let lk = 0for (r of likesTable.iterate(null, null)) { if (r.ticket == id || seen[r.event] == true) { lk = lk + 1 } }let at = 0let files = 0for (a of attachmentsTable.iterate(null, null)) {if (a.ticket == id || seen[a.event] == true) {at = at + 1if (exists(filesDir + '/' + a.file)) { files = files + 1 }}}links = countOf(linksTable.find('ticket', id)) + countOf(linksTable.find('other', id))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
- e843ff7cOne-time purge of miserit-anthar#94 (#94, identity rule): idempotent step in lib/migrate.hl, fixture gate tests/purge94.mjsmre
- 506a4efdmission 028: #94, identity rulemre
- 78c7f48eRefine mpackdb holdmre
- 3d7d89c8Record mpackdb hold until day38mre
- f1bf7195#51 done; my subscription idmre
- 9870b945status: #51 proof greenmre
- e92173c6log: #51 live push proofmre
- 72d87041log: Hermes push livemre
- 1d69bf7dTickets conductor: park until Hermes pushmre
- 80d8cfd1Tickets conductor: #51 livemre
- 61641dd9Complete subscriptions deployment evidencemre
- c980856cRecord successful subscriptions deployment and live checksmre
- 4b4710adMerge branch 's51-subscriptions'mre
- a731ef7eTickets conductor: S51 reviewed, deploy stepmre
- b487b05aRecord verified direct push protocol handoffmre
- 74e34cc3Verify encrypted push secrets and direct push retry semanticsmre
- a1ac5cd0Push subscription notices directly to signed HyperConductor chat endpointsmre
- d662ad27Remove superseded waker service for direct chat push protocolmre
- c0ac927aTickets conductor: S51 redo for push protocolmre
- ff2e8701Finalize subscription build verification and handoff reportmre