update pending
This commit is contained in:
@@ -14,7 +14,6 @@ https://en.wikipedia.org/wiki/Majority_judgment
|
|||||||
|
|
||||||
After some research most of implementation is done in https://github.com/MieuxVoter
|
After some research most of implementation is done in https://github.com/MieuxVoter
|
||||||
|
|
||||||
|
|
||||||
Sorry for inconvenience but currently only french version is available.
|
Sorry for inconvenience but currently only french version is available.
|
||||||
|
|
||||||
LISEZMOI.md
|
LISEZMOI.md
|
||||||
@@ -51,3 +50,10 @@ dev done on Ubuntu 24.04.2 LTS
|
|||||||
cd code
|
cd code
|
||||||
./check_csv.sh ../samples/nextcloud_poll_export/poll1.csv
|
./check_csv.sh ../samples/nextcloud_poll_export/poll1.csv
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
./check_csv.sh ../samples/nextcloud_poll_export/poll1.csv >../samples/0.json
|
||||||
|
```
|
||||||
|
|
||||||
|
et tester
|
||||||
|
|
||||||
|
|||||||
@@ -3,41 +3,41 @@ import sys
|
|||||||
import csv
|
import csv
|
||||||
|
|
||||||
# using non modified nextcloud standard text poll
|
# using non modified nextcloud standard text poll
|
||||||
nom_mentions=['yes','maybe','','no']
|
mentions_name=['yes','maybe','','no']
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
csv_file=sys.argv[1]
|
csv_file=sys.argv[1]
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
nom_mentions=[]
|
mentions_name=[]
|
||||||
for i in range(2,len(sys.argv)):
|
for i in range(2,len(sys.argv)):
|
||||||
nom_mentions.append(sys.argv[i])
|
mentions_name.append(sys.argv[i])
|
||||||
else:
|
else:
|
||||||
print('missing file argument')
|
print('missing file argument')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
def mention_index(mention):
|
def mention_index(mention):
|
||||||
return nom_mentions.index(mention)
|
return mentions_name.index(mention)
|
||||||
|
|
||||||
verbose=False
|
verbose=False
|
||||||
|
|
||||||
mentions=len(nom_mentions)
|
mentions=len(mentions_name)
|
||||||
default_mention=mentions-1
|
default_mention=mentions-1
|
||||||
|
|
||||||
warnings=[]
|
warnings=[]
|
||||||
candidats={}
|
candidates={}
|
||||||
candidats_alias=[]
|
candidates_alias=[]
|
||||||
a_vote={}
|
a_vote={}
|
||||||
votes=[]
|
votes=[]
|
||||||
with open(csv_file,'r') as csv_fd:
|
with open(csv_file,'r') as csv_fd:
|
||||||
vote_reader = csv.reader(csv_fd, delimiter=',')
|
vote_reader = csv.reader(csv_fd, delimiter=',')
|
||||||
for row in vote_reader:
|
for row in vote_reader:
|
||||||
if len(candidats_alias) == 0:
|
if len(candidates_alias) == 0:
|
||||||
for i in range(2,len(row)):
|
for i in range(2,len(row)):
|
||||||
candidat_alias=row[i]
|
candidate_alias=row[i]
|
||||||
candidats_alias.append(candidat_alias)
|
candidates_alias.append(candidate_alias)
|
||||||
# no other name given
|
# no other name given
|
||||||
if not candidat_alias in candidats:
|
if not candidate_alias in candidates:
|
||||||
candidats[candidat_alias]=candidat_alias
|
candidates[candidate_alias]=candidate_alias
|
||||||
else:
|
else:
|
||||||
# check if not duplicated
|
# check if not duplicated
|
||||||
participant=row[0]
|
participant=row[0]
|
||||||
@@ -47,20 +47,20 @@ with open(csv_file,'r') as csv_fd:
|
|||||||
a_vote[participant]=row[1]
|
a_vote[participant]=row[1]
|
||||||
vote={}
|
vote={}
|
||||||
for i in range(2,len(row)):
|
for i in range(2,len(row)):
|
||||||
candidat_index=i-2
|
candidate_index=i-2
|
||||||
candidat_alias=candidats_alias[candidat_index]
|
candidate_alias=candidates_alias[candidate_index]
|
||||||
mention=row[i]
|
mention=row[i]
|
||||||
vote[candidat_alias]=mention_index(mention)
|
vote[candidate_alias]=mention_index(mention)
|
||||||
votes.append(vote)
|
votes.append(vote)
|
||||||
|
|
||||||
|
|
||||||
default_vote={}
|
default_vote={}
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print(','.join(candidats))
|
print(','.join(candidates))
|
||||||
print(','.join(nom_mentions))
|
print(','.join(mentions_name))
|
||||||
|
|
||||||
result = {'candidats':candidats,'votants':{'decompte':len(a_vote)},'mentions':nom_mentions,'votation':{'votes':votes}}
|
result = {'candidates':candidates,'voters':{'count':len(a_vote)},'mentions':mentions_name,'votation':{'votes':votes}}
|
||||||
print(json.dumps(result))
|
print(json.dumps(result))
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
# contexte
|
# contexte
|
||||||
|
|
||||||
Choix des noms de mentions
|
Choix des noms de mentions
|
||||||
|
|
||||||
|
|
||||||
https://fr.wikipedia.org/wiki/Jugement_majoritaire
|
https://fr.wikipedia.org/wiki/Jugement_majoritaire
|
||||||
vs
|
vs
|
||||||
https://en.wikipedia.org/wiki/Jugement_majoritaire
|
https://en.wikipedia.org/wiki/Jugement_majoritaire
|
||||||
|
|||||||
4
nextcloud_devenv/logs.sh
Normal file
4
nextcloud_devenv/logs.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
nextcloud_storage=/var/wwww/http/data
|
||||||
|
sudo -u www-data tail -f $nextcloud_storage/nextcloud.log
|
||||||
6
nextcloud_devenv/reset_polls.sh
Executable file
6
nextcloud_devenv/reset_polls.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
./get_dbcontent.sh
|
||||||
|
./run_occ.sh polls:db:purge
|
||||||
|
./run_occ.sh app:enable polls
|
||||||
|
./run_occ.sh polls:db:rebuild
|
||||||
@@ -1,2 +1,5 @@
|
|||||||
Participants,Adresse e-mail,A,B,C
|
Participants,Adresse e-mail,A,B,C
|
||||||
admin,,Très Bien,Bien,Assez Bien
|
admin,,Très Bien,Bien,Assez Bien
|
||||||
|
user1,,Très Bien,Bien,Assez Bien
|
||||||
|
user2,,Très Bien,Bien,Assez Bien
|
||||||
|
user3,,Très Bien,Bien,Assez Bien
|
||||||
|
Reference in New Issue
Block a user