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
- 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
- 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
- c69cd5f3Merge branch 'pr-flow' into mainTickets
- cc56798cLog gitoria PR-only requestmre
- d876d0b2|||PR README: changes land as PRsmre
- fd83ac1fconductor: caramboleyo is the user, not owner/creatorApollo