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
- cd3641a1|||PR records: day72 deploy live, tickets closedmre
- 7d44d852Merge branch 'records-t37' into mainTickets
- 926f7061|||PR records: merges, D36 deploymre
- bf58534eMerge branch 'l33-final' into mainTickets
- 759a9ac3|||PR thin login (tickets#46, #45): merge main, route entry cleanupmre
- 239436d8Merge remote-tracking branch 'origin/main' into l33-finalmre
- 5822cb3aMerge branch 'o34-clean' into mainTickets
- 0870653c|||PR offline note from __hlOnline, no polling (tickets#41)mre
- 14cf96b4Merge branch 'records-t36' into mainTickets
- 07749fa1|||PR records: day72 + #40 mergedmre
- 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