2 Commits

Author SHA1 Message Date
Yannick Le Duc
c840470521 rend + simple à lire la page des statistiques 2025-09-22 09:05:57 +02:00
Yannick Le Duc
d38c21944a fix version display to 0.2.1 2025-09-22 06:45:28 +02:00
4 changed files with 18 additions and 10 deletions

View File

@@ -31,6 +31,7 @@ export interface PropositionStats {
participationRate: number;
voteDistribution: number;
consensusScore: number;
averagePerTotalVoters: number;
}
type SortOption =
@@ -247,25 +248,25 @@ export function StatsDisplay({
</div>
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4">
<div className="text-center">
<p className="text-2xl font-bold text-purple-600 dark:text-purple-400">
{stat.averagePerTotalVoters}
</p>
<p className="text-xs text-slate-500 dark:text-slate-400">Moyenne / total votants</p>
</div>
<div className="text-center">
<p className="text-2xl font-bold text-blue-600 dark:text-blue-400">
{stat.voteCount}
</p>
<p className="text-xs text-slate-500 dark:text-slate-400">
{stat.voteCount === 1 ? 'Votant' : 'Votants'}
{stat.voteCount === 1 ? 'Soutien' : 'Soutiens'}
</p>
</div>
<div className="text-center">
<p className="text-2xl font-bold text-green-600 dark:text-green-400">
{stat.averageAmount}
</p>
<p className="text-xs text-slate-500 dark:text-slate-400">Moyenne</p>
</div>
<div className="text-center">
<p className="text-2xl font-bold text-purple-600 dark:text-purple-400">
{stat.totalAmount}
</p>
<p className="text-xs text-slate-500 dark:text-slate-400">Total</p>
<p className="text-xs text-slate-500 dark:text-slate-400">Moyenne des soutiens</p>
</div>
<div className="text-center">
<p className="text-2xl font-bold text-orange-600 dark:text-orange-400">

View File

@@ -12,7 +12,7 @@ export default function VersionDisplay() {
.then(data => setVersion(data.version))
.catch(() => {
// Fallback si le fichier n'est pas accessible
setVersion('0.2.0');
setVersion('0.2.1');
});
}, []);

View File

@@ -31,6 +31,11 @@ export function useStatsCalculation(
// Calculer la répartition des votes (nombre de montants différents)
const uniqueAmounts = new Set(amounts).size;
// Calculer la moyenne par rapport au nombre total de votants
const averagePerTotalVoters = participants.length > 0
? Math.round(totalAmount / participants.length)
: 0;
return {
proposition,
voteCount: propositionVotes.length,
@@ -40,7 +45,8 @@ export function useStatsCalculation(
totalAmount,
participationRate: Math.round(participationRate * 100) / 100,
voteDistribution: uniqueAmounts,
consensusScore: Math.round(consensusScore * 100) / 100
consensusScore: Math.round(consensusScore * 100) / 100,
averagePerTotalVoters
};
});
}, [campaign, participants, propositions, votes]);

View File

@@ -39,6 +39,7 @@ export interface PropositionStats {
participationRate: number;
voteDistribution: number;
consensusScore: number;
averagePerTotalVoters: number;
}
export async function generateVoteExport(data: ExportData): Promise<{ data: Uint8Array | string; format: ExportFileFormat }> {