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
- 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
- 3b858c91Log backup hard-link fixmre
- 7f6b37a0deploy.sh backup: tar --hard-dereference (hard links broke mpackdb sidecars on restore)mre
- e93711d9Log E30 livemre
- 59c02e4dMerge e30: preserve edited state note labels in Markdownmre
- 30970796Log E30 deploy GOmre
- 7c8e6d83Limit edited state note fix to Markdown renderingmre
- 910536d0Log E30 reviewmre
- 36984386Preserve state transitions when their notes are editedmre
- d75cb946Log E30 startmre
- 0bf3fefaMission 030: edited state note labelmre
- 691565c6Log neutral-ticket rule checkmre
- bc3bdecerecords: day38b live, #94 purgedmre
- f6c5aa0dMerge main (records)mre
- e23d42acconnect gate: wait for hydration before clicking Disconnectmre
- a5d45d00records: D38 cause, GOmre
- 19eeb938records: D38 gates, two day38b failuresmre