Compare commits
2 Commits
238e57e8e6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c840470521 | ||
|
|
d38c21944a |
@@ -31,6 +31,7 @@ export interface PropositionStats {
|
|||||||
participationRate: number;
|
participationRate: number;
|
||||||
voteDistribution: number;
|
voteDistribution: number;
|
||||||
consensusScore: number;
|
consensusScore: number;
|
||||||
|
averagePerTotalVoters: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
type SortOption =
|
type SortOption =
|
||||||
@@ -247,25 +248,25 @@ export function StatsDisplay({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4">
|
<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">
|
<div className="text-center">
|
||||||
<p className="text-2xl font-bold text-blue-600 dark:text-blue-400">
|
<p className="text-2xl font-bold text-blue-600 dark:text-blue-400">
|
||||||
{stat.voteCount}
|
{stat.voteCount}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-slate-500 dark:text-slate-400">
|
<p className="text-xs text-slate-500 dark:text-slate-400">
|
||||||
{stat.voteCount === 1 ? 'Votant' : 'Votants'}
|
{stat.voteCount === 1 ? 'Soutien' : 'Soutiens'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<p className="text-2xl font-bold text-green-600 dark:text-green-400">
|
<p className="text-2xl font-bold text-green-600 dark:text-green-400">
|
||||||
{stat.averageAmount}€
|
{stat.averageAmount}€
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-slate-500 dark:text-slate-400">Moyenne</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-purple-600 dark:text-purple-400">
|
|
||||||
{stat.totalAmount}€
|
|
||||||
</p>
|
|
||||||
<p className="text-xs text-slate-500 dark:text-slate-400">Total</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<p className="text-2xl font-bold text-orange-600 dark:text-orange-400">
|
<p className="text-2xl font-bold text-orange-600 dark:text-orange-400">
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default function VersionDisplay() {
|
|||||||
.then(data => setVersion(data.version))
|
.then(data => setVersion(data.version))
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
// Fallback si le fichier n'est pas accessible
|
// Fallback si le fichier n'est pas accessible
|
||||||
setVersion('0.2.0');
|
setVersion('0.2.1');
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ export function useStatsCalculation(
|
|||||||
// Calculer la répartition des votes (nombre de montants différents)
|
// Calculer la répartition des votes (nombre de montants différents)
|
||||||
const uniqueAmounts = new Set(amounts).size;
|
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 {
|
return {
|
||||||
proposition,
|
proposition,
|
||||||
voteCount: propositionVotes.length,
|
voteCount: propositionVotes.length,
|
||||||
@@ -40,7 +45,8 @@ export function useStatsCalculation(
|
|||||||
totalAmount,
|
totalAmount,
|
||||||
participationRate: Math.round(participationRate * 100) / 100,
|
participationRate: Math.round(participationRate * 100) / 100,
|
||||||
voteDistribution: uniqueAmounts,
|
voteDistribution: uniqueAmounts,
|
||||||
consensusScore: Math.round(consensusScore * 100) / 100
|
consensusScore: Math.round(consensusScore * 100) / 100,
|
||||||
|
averagePerTotalVoters
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}, [campaign, participants, propositions, votes]);
|
}, [campaign, participants, propositions, votes]);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export interface PropositionStats {
|
|||||||
participationRate: number;
|
participationRate: number;
|
||||||
voteDistribution: number;
|
voteDistribution: number;
|
||||||
consensusScore: number;
|
consensusScore: number;
|
||||||
|
averagePerTotalVoters: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateVoteExport(data: ExportData): Promise<{ data: Uint8Array | string; format: ExportFileFormat }> {
|
export async function generateVoteExport(data: ExportData): Promise<{ data: Uint8Array | string; format: ExportFileFormat }> {
|
||||||
|
|||||||
Reference in New Issue
Block a user