// ---
// import Layout from '../layouts/BlogPost.astro'
// // import { sql } from '../content.config'
// import fs from 'fs'
// import path from 'path'
// import ical, { ICalCalendarMethod } from 'ical-generator'
// import { convertToCSV, isDev } from '../utils'
// import { query } from '../../db.ts'
//
// const d =
// await query(`select date, time, opponent, sets_won:: int, sets_lost:: int, dinner_location, is_tournament, count (*) over (partition by date):: int games_per_day
// from noco.volleyball
// order by date, time`)
//
// const winCount = d.reduce((acc, x) => acc + x.sets_won, 0)
// const lossCount = d.reduce((acc, x) => acc + x.sets_lost, 0)
// const total = d.reduce((acc, x) => acc + (x.sets_won ?? 3) + x.sets_lost, 0)
// const completion = Math.floor(((winCount + lossCount) / total) * 100)
//
// const csvData = convertToCSV(d)
// const filePath = path.join('public', '2025-volleyball-data.csv')
// fs.writeFileSync(filePath, csvData)
//
// // generate ical
// const calendar = ical({ name: 'Volleyball Schedule' })
// calendar.method(ICalCalendarMethod.REQUEST)
//
// d.forEach((entry) => {
// const justTime = +entry.time.split(':')[0]
// const start = new Date(entry.date)
// start.setHours(justTime)
//
// const end = new Date(start)
// end.setHours(end.getHours() + 1)
//
// calendar.createEvent({
// start,
// end,
// summary: 'Volleyball Game'
// })
// })
// const calPath = path.join('public', '2025-volleyball.ics')
// fs.writeFileSync(calPath, calendar.toString())
// ---
//
//
// We lost our first single elimination tournament and that's all she wrote. We gave it a valiant effort and I think next season we'll give it a good run. We started not knowing certain rules, so it has been really fun.
//
// Aside: Gear I like to use for volleyball
// Tournament
// Season Stats
// Sets Won:
// {winCount}Sets Lost:
// {lossCount}Total Sets:
//
//
// {total}
//
// Season Game History
//
//
//
//
// CSV Download
//
//
//
//
// {
// d.map((x) => {
// const highlight = x.games_per_day > 1 && x.date > new Date()
//
// return (
// Date
// Opponent
// Sets Won
// Sets Lost
// Dinner
//
//
// )
// })
// }
//
//
// blue date means multiple games on that date
//
// {x.date.toLocaleDateString()}
// {+x.time.split(':')[0] - 12}pm
//
//
// {x.is_tournament ? {x.opponent}: x.opponent}
//
// {x.sets_won}
// {x.sets_lost}
// {x.dinner_location}
//
// highlighted
// means tournament
// {
// isDev() && (
// <>
//
//
//
// Update Table (Noco)
//
// >
// )
// }
//
// ics File
//