...
|
...
|
@@ -136,9 +136,10 @@ function update_database () {
|
136
|
136
|
}
|
137
|
137
|
|
138
|
138
|
function write_comparaison () {
|
|
139
|
+
|
139
|
140
|
result="comparaisons ${groupe[0]} avec ${groupe_ref:-GDR}${dossier:+ - ${dossier}}"
|
140
|
141
|
content="/dev/shm/$result/content.xml"
|
141
|
|
- id_cols="Scrutin Date Titre Adoption"
|
|
142
|
+ id_cols="Scrutin Date Titre Adoption Panurgisme${nom:+ Participation Loyauté}"
|
142
|
143
|
typevotes=$(sqlite_request "select nom from votes")
|
143
|
144
|
nb_cols=$(( $(wc -w <<< $id_cols) + $(wc -w <<< $typevotes) * ${#groupe[@]} ))
|
144
|
145
|
last_col=$(awk -v n=$nb_cols 'BEGIN{printf("%c%c", n < 27 ? "" : int(n/26) + 64, (n % 26) + (n % 26 == 0 ? 26 : 0) + 64)}' | tr -d '\0')
|
...
|
...
|
@@ -272,8 +273,9 @@ EOcontent
|
272
|
273
|
<text:p>${adoption}</text:p>
|
273
|
274
|
</table:table-cell>
|
274
|
275
|
EOcontent
|
|
276
|
+
|
275
|
277
|
for typevote in 0 1 2 3; do
|
276
|
|
- votes=$(sqlite_request "select
|
|
278
|
+ vote_cible[$typevote]=$(sqlite_request "select
|
277
|
279
|
count(député)
|
278
|
280
|
from
|
279
|
281
|
dépouillement
|
...
|
...
|
@@ -283,9 +285,52 @@ EOcontent
|
283
|
285
|
vote is $typevote
|
284
|
286
|
and
|
285
|
287
|
groupe is ${groupe_id[0]} ${nom:+ and député is ${nom%|*}}")
|
|
288
|
+ done
|
|
289
|
+ if test \( ${vote_cible[0]} -gt ${vote_cible[1]} -a $adoption = oui \) \
|
|
290
|
+ -o \( ${vote_cible[1]} -gt ${vote_cible[0]} -a $adoption = non \); then
|
|
291
|
+ panurge=1
|
|
292
|
+ else
|
|
293
|
+ panurge=0
|
|
294
|
+ fi
|
|
295
|
+ cat >> "$content" << EOcontent
|
|
296
|
+ <table:table-cell office:value-type="float" office:value="$panurge" calcext:value-type="float">
|
|
297
|
+ <text:p>$panurge</text:p>
|
|
298
|
+ </table:table-cell>
|
|
299
|
+EOcontent
|
|
300
|
+
|
|
301
|
+ if test -n "$nom"; then
|
|
302
|
+ for typevote in 0 1; do
|
|
303
|
+ votes_g0[$typevote]=$(sqlite_request "select
|
|
304
|
+ count(député)
|
|
305
|
+ from
|
|
306
|
+ dépouillement
|
|
307
|
+ where
|
|
308
|
+ scrutin is $scrutin
|
|
309
|
+ and
|
|
310
|
+ vote is $typevote
|
|
311
|
+ and
|
|
312
|
+ groupe is ${groupe_id[0]}")
|
|
313
|
+ done
|
|
314
|
+ participation=$(( vote_cible[0] + vote_cible[1] + vote_cible[2] + vote_cible[3] ))
|
|
315
|
+ if test $(( (${votes_g0[0]} - ${votes_g0[1]}) * (${vote_cible[0]} - ${vote_cible[1]}) )) -gt 0; then
|
|
316
|
+ loyaute=1
|
|
317
|
+ else
|
|
318
|
+ loyaute=0
|
|
319
|
+ fi
|
|
320
|
+ cat >> "$content" << EOcontent
|
|
321
|
+ <table:table-cell office:value-type="float" office:value="$participation" calcext:value-type="float">
|
|
322
|
+ <text:p>$participation</text:p>
|
|
323
|
+ </table:table-cell>
|
|
324
|
+ <table:table-cell office:value-type="float" office:value="$loyaute" calcext:value-type="float">
|
|
325
|
+ <text:p>$loyaute</text:p>
|
|
326
|
+ </table:table-cell>
|
|
327
|
+EOcontent
|
|
328
|
+ fi
|
|
329
|
+
|
|
330
|
+ for typevote in 0 1 2 3; do
|
286
|
331
|
cat >> "$content" << EOcontent
|
287
|
|
- <table:table-cell office:value-type="float" office:value="$votes" calcext:value-type="float">
|
288
|
|
- <text:p>$votes</text:p>
|
|
332
|
+ <table:table-cell office:value-type="float" office:value="${vote_cible[$typevote]}" calcext:value-type="float">
|
|
333
|
+ <text:p>${vote_cible[$typevote]}</text:p>
|
289
|
334
|
</table:table-cell>
|
290
|
335
|
EOcontent
|
291
|
336
|
for (( g = 1; g < ${#groupe_id[@]}; g++ )); do
|