update pending
This commit is contained in:
10
README.md
10
README.md
@@ -14,7 +14,6 @@ https://en.wikipedia.org/wiki/Majority_judgment
|
||||
|
||||
After some research most of implementation is done in https://github.com/MieuxVoter
|
||||
|
||||
|
||||
Sorry for inconvenience but currently only french version is available.
|
||||
|
||||
LISEZMOI.md
|
||||
@@ -50,4 +49,11 @@ dev done on Ubuntu 24.04.2 LTS
|
||||
```
|
||||
cd code
|
||||
./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
|
||||
|
||||
# using non modified nextcloud standard text poll
|
||||
nom_mentions=['yes','maybe','','no']
|
||||
mentions_name=['yes','maybe','','no']
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
csv_file=sys.argv[1]
|
||||
if len(sys.argv) > 2:
|
||||
nom_mentions=[]
|
||||
mentions_name=[]
|
||||
for i in range(2,len(sys.argv)):
|
||||
nom_mentions.append(sys.argv[i])
|
||||
mentions_name.append(sys.argv[i])
|
||||
else:
|
||||
print('missing file argument')
|
||||
exit(1)
|
||||
|
||||
def mention_index(mention):
|
||||
return nom_mentions.index(mention)
|
||||
return mentions_name.index(mention)
|
||||
|
||||
verbose=False
|
||||
|
||||
mentions=len(nom_mentions)
|
||||
mentions=len(mentions_name)
|
||||
default_mention=mentions-1
|
||||
|
||||
warnings=[]
|
||||
candidats={}
|
||||
candidats_alias=[]
|
||||
candidates={}
|
||||
candidates_alias=[]
|
||||
a_vote={}
|
||||
votes=[]
|
||||
with open(csv_file,'r') as csv_fd:
|
||||
vote_reader = csv.reader(csv_fd, delimiter=',')
|
||||
for row in vote_reader:
|
||||
if len(candidats_alias) == 0:
|
||||
if len(candidates_alias) == 0:
|
||||
for i in range(2,len(row)):
|
||||
candidat_alias=row[i]
|
||||
candidats_alias.append(candidat_alias)
|
||||
candidate_alias=row[i]
|
||||
candidates_alias.append(candidate_alias)
|
||||
# no other name given
|
||||
if not candidat_alias in candidats:
|
||||
candidats[candidat_alias]=candidat_alias
|
||||
if not candidate_alias in candidates:
|
||||
candidates[candidate_alias]=candidate_alias
|
||||
else:
|
||||
# check if not duplicated
|
||||
participant=row[0]
|
||||
@@ -47,20 +47,20 @@ with open(csv_file,'r') as csv_fd:
|
||||
a_vote[participant]=row[1]
|
||||
vote={}
|
||||
for i in range(2,len(row)):
|
||||
candidat_index=i-2
|
||||
candidat_alias=candidats_alias[candidat_index]
|
||||
candidate_index=i-2
|
||||
candidate_alias=candidates_alias[candidate_index]
|
||||
mention=row[i]
|
||||
vote[candidat_alias]=mention_index(mention)
|
||||
vote[candidate_alias]=mention_index(mention)
|
||||
votes.append(vote)
|
||||
|
||||
|
||||
default_vote={}
|
||||
|
||||
if verbose:
|
||||
print(','.join(candidats))
|
||||
print(','.join(nom_mentions))
|
||||
print(','.join(candidates))
|
||||
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))
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
|
||||
# contexte
|
||||
|
||||
Choix des noms de mentions
|
||||
|
||||
|
||||
https://fr.wikipedia.org/wiki/Jugement_majoritaire
|
||||
vs
|
||||
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
|
||||
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