utxo-prague/utils/stats.js

28 řádky
721 B
JavaScript
Surový Normální zobrazení Historie

2022-01-03 20:24:19 +01:00
import { Table } from "https://deno.land/x/cliffy@v0.20.1/table/mod.ts"
import { UTXOEngine } from './engine.js'
const utxo = new UTXOEngine({ silent: true })
await utxo.init()
const entryId = '22'
const entry = utxo.entries[entryId]
const tracksCount = {}
for (const sp of entry.specs.speakers) {
for (const tr of sp.tracks) {
if (!tracksCount[tr]) {
tracksCount[tr] = 0
}
tracksCount[tr]++
}
}
2022-01-04 09:32:08 +01:00
const tracks = entry.specs.tracks.map(t => [t.id, '|' + '+'.repeat(tracksCount[t.id] || '0' ) ])
2022-01-03 20:24:19 +01:00
const table = Table.from(tracks)
2022-01-04 09:32:08 +01:00
//table.border(true)
2022-01-03 20:24:19 +01:00
2022-01-04 09:32:08 +01:00
console.log('\nRozložení jednotlivých tématických sekcí dle přednášejících:\n' + '-'.repeat(60))
console.log(table.toString() + '\n')
2022-01-03 20:24:19 +01:00