Recherche des projets de code autours du jugement majoritaire sur githbu
|source|info|interet|
|------------------|-----------------------------|-------------|
|https://github.com/AlexJade23/JugementMajoritaire|RAS VIDE|1/20|
|https://github.com/ostix360/JugementMajoritaire|Où est l'algo ?|2/20|
|https://github.com/CitoyensDeDemain/JugementMajoritaire|Il y a un algo, mais pas de format de donnée, données hardcodées / API et pas de procédure d'install|11/20|
# david chavalarias
https://github.com/davidchavalarias/jugement-majoritaire
Dans le cadre d'une soutenance en 2014 le porjet n'a pas été maintenu ni forké.
Une application sous symfony2 ( php Doctrine )
mysql / apache
./Polytech/Bundle/JMBundle
Algorithme principal :
```
public function statsAction($idElection)
{
$em = $this->getDoctrine()->getManager();
$currentElections = $em->getRepository('PolytechJMBundle:Election')->findCurrentElections();
$election = $em->getRepository('PolytechJMBundle:Election')->find($idElection);
if($election->getFinished() == false)
{
return $this->redirect($this->generateUrl('polytech_jm_index'));
}
$candidats = $em->getRepository('PolytechJMBundle:Candidat')->findByElection($election->getId());
$mentions = $em->getRepository('PolytechJMBundle:Mention')->findByElection($election->getId());
$nbrVotes = array();
$indMentionMaj = array();
$nbVMention = array();
foreach($candidats as $cand)
{
$n = $em->getRepository('PolytechJMBundle:Vote')->countVotesByCandidat($cand->getId());
$nbrVotes[$cand->getNom()] = $n[1];
$nbrVotesMentionTmp = array();
$pourcentageMention = array();
foreach($mentions as $m)
{
$temp = $em->getRepository('PolytechJMBundle:Vote')->countVotesByCandidatAndMention($cand->getId(), $m->getId());
$nbrVotesMentionTmp[$m->getNom()] = $temp[1];
if($nbrVotes[$cand->getNom()] == 0)
{
$pourcentageMention[$m->getNom()] = 0;
}
else
{
$pourcentageMention[$m->getNom()] = $nbrVotesMentionTmp[$m->getNom()]*100/$nbrVotes[$cand->getNom()];
}
}
$p_maj = 0;
$i_maj = 0;
$plus = 0;
foreach($mentions as $m){
$p_maj +=$pourcentageMention[$m->getNom()];
$i_maj += 1;
if($p_maj < 50)
{
$plus += $pourcentageMention[$m->getNom()];
}
if($p_maj >= 50) break;
}
$moins = 100-($plus+$pourcentageMention[$m->getNom()]);
$nbVMention[$cand->getNom()] = $nbrVotesMentionTmp;
if(!isset($indMentionMaj[$i_maj]))
{
$indMentionMaj[$i_maj]=array();
}
if($plus >= $moins)
{
if(!isset($indMentionMaj[$i_maj][0]))
{
$indMentionMaj[$i_maj][0] = array();
}
$indMentionMaj[$i_maj][0][$cand->getNom()] = $plus;
}
else
{
if(!isset($indMentionMaj[$i_maj][1]))
{
$indMentionMaj[$i_maj][1] = array();
}
$indMentionMaj[$i_maj][1][$cand->getNom()] = $moins;
}
}
//asort($indMentionMaj);
ksort($indMentionMaj);
foreach($indMentionMaj as &$indV)
{
if(isset($indV[0]))
{
arsort($indV[0]);
}
if(isset($indV[1]))
{
asort($indV[1]);
}
}
return $this->render('PolytechJMBundle:Default:stats.html.twig', array('currentElections' => $currentElections, 'election' => $election, 'nbVMention' => $nbVMention, 'mentions' => $mentions, 'indMentionMaj' => $indMentionMaj, 'nbC' => count($candidats)));
}
```
# Ringayend
2016
https://github.com/Ringayend/Jugement-Majoritaire
Le site utilisant ce code n'existe plus : n'existe https://jugement-majoritaire.herokuapp.com
Site php simple, pas de framework postgres uniquement, en direct ( https://www.php.net/manual/en/function.pg-query.php pas d'ORM )
Permet l'export en excel
```
plhardy@t540p:~/clients/astrolabe/nextcloud/poll/existant/Ringayend.Jugement-Majoritaire.$ cat models/JM.sql
DROP TABLE ELECTEUR;
DROP TABLE CANDIDAT;
DROP TABLE BULLETIN;
CREATE TABLE ELECTEUR (
IDENTIFIANT varchar(255),
NOM varchar(255),
PRENOM varchar(255),
DONE boolean,
ADMIN boolean,
PASSWORD varchar(255),
CONSTRAINT electeur_pk primary key (IDENTIFIANT)
);
CREATE TABLE CANDIDAT (
ID bigserial,
NAME varchar(255) constraint nameCandidat not null,
TB bigint,
B bigint,
AB bigint,
P bigint,
I bigint,
AR bigint,
CONSTRAINT candidat_pk primary key (ID)
);
CREATE TABLE BULLETIN(
IDENTIFIANT varchar(255),
ID bigserial,
TB bigint,
B bigint,
AB bigint,
P bigint,
I bigint,
AR bigint,
constraint bulletin_pk primary key (IDENTIFIANT,ID),
CONSTRAINT bulletin_fk1 FOREIGN KEY (IDENTIFIANT) REFERENCES ELECTEUR(IDENTIFIANT),
CONSTRAINT bulletin_fk2 FOREIGN KEY (ID) REFERENCES CANDIDAT(ID)
);
```
```
```
Les mentions sont codées en dur : TB,B,AB,P,I,AR
resultat ?
```
Nom
Très Bien
Bien
Assez Bien
Passable
Insuffisant
À rejeter
Mention finale
Pourcentage des mentions supérieures