- `aggregateResults` ingests rating maps, tallies per-option counts + histogram (1-5 buckets) + running sum, then `finalise` computes per-option means and sorts options by mean desc with tiebreaks (count of 5s, then 4s, then total count, then id). Question-level `count` reflects submissions that rated at least one option. - Out-of-range, fractional, and non-integer ratings are silently dropped — the aggregator never trusts user data, schema validates it on submit. - CSV export expands a date_ranked_choice question into one column per option named `<qid>[<optid>]`. JSON export is unchanged (it serialises the rating map directly). - New `results.test.ts` covers: per-option counts and means, histogram tallying, mean-with-tiebreak ordering, ignoring bad ratings, and missing answers. Wires the file into the `bun test` script. Refs m/fdbck#1.
30 lines
771 B
JSON
30 lines
771 B
JSON
{
|
|
"name": "fdbck",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "vite dev",
|
|
"build": "vite build",
|
|
"preview": "vite preview",
|
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
"start": "node build/index.js",
|
|
"test": "bun test ./src/lib/server/rate-limit.test.ts ./src/lib/server/public-scope.test.ts ./src/lib/server/results.test.ts"
|
|
},
|
|
"devDependencies": {
|
|
"@sveltejs/adapter-node": "^5.5.4",
|
|
"@sveltejs/kit": "^2.15.0",
|
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
"@types/bun": "^1.3.13",
|
|
"svelte": "^5.0.0",
|
|
"svelte-check": "^4.0.0",
|
|
"typescript": "^5.0.0",
|
|
"vite": "^6.0.0"
|
|
},
|
|
"dependencies": {
|
|
"@supabase/supabase-js": "^2.104.1",
|
|
"postgres": "^3.4.9",
|
|
"zod": "^4.3.6"
|
|
}
|
|
}
|