utxo-prague/utils/stats.js

31 řádky
746 B
JavaScript
Surový Trvalý odkaz Normální zobrazení Historie

2022-01-14 17:56:42 +01:00
import { Table } from "https://deno.land/x/cliffy@v0.20.1/table/mod.ts";
import { UTXOEngine } from "./engine.js";
2022-01-03 20:24:19 +01:00
2022-01-14 17:56:42 +01:00
const utxo = new UTXOEngine({ silent: true });
await utxo.init();
2022-01-03 20:24:19 +01:00
2022-01-14 17:56:42 +01:00
const entryId = "22";
const entry = utxo.entries[entryId];
2022-01-03 20:24:19 +01:00
2022-01-14 17:56:42 +01:00
const tracksCount = {};
2022-01-03 20:24:19 +01:00
for (const sp of entry.specs.speakers) {
for (const tr of sp.tracks) {
if (!tracksCount[tr]) {
2022-01-14 17:56:42 +01:00
tracksCount[tr] = 0;
2022-01-03 20:24:19 +01:00
}
2022-01-14 17:56:42 +01:00
tracksCount[tr]++;
2022-01-03 20:24:19 +01:00
}
}
2022-01-14 17:56:42 +01:00
const tracks = entry.specs.tracks.map(
(t) => [t.id, "|" + "+".repeat(tracksCount[t.id] || "0")],
);
2022-01-03 20:24:19 +01:00
2022-01-14 17:56:42 +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-14 17:56:42 +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");