Initial commit: Visigine (Vite client + Express/SQLite backend)
Container-ready via docker/ compose (frontend nginx + backend Node). Compose adjusted for Coolify on the prod server: frontend uses expose:80 (no host binding — host 8080 is taken by the Coolify proxy; Traefik routes visigine.de), backend ALLOWED_ORIGINS=https://visigine.de. Secrets stay in server/.env (git-ignored); see server/.env.example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
15
server/lib/scoring.js
Normal file
15
server/lib/scoring.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const WEIGHTS = { high: 3, medium: 2, low: 1 }
|
||||
|
||||
export function computeScore(results) {
|
||||
if (!Array.isArray(results) || results.length === 0) return 1
|
||||
let earned = 0
|
||||
let max = 0
|
||||
for (const r of results) {
|
||||
const w = WEIGHTS[r.severity] || 1
|
||||
max += w
|
||||
if (r.passed) earned += w
|
||||
}
|
||||
if (max === 0) return 1
|
||||
const raw = 1 + 9 * (earned / max)
|
||||
return Math.max(1, Math.min(10, Math.round(raw)))
|
||||
}
|
||||
Reference in New Issue
Block a user