Modulo:Elezioni/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
mNessun oggetto della modifica
Nessun oggetto della modifica
Riga 116:
local num = 0
local tot,tot2 = 0,0
local dati = {}
 
ss = '<table class="wikitable" style="text-align:right;margin:10px auto"><caption>'..titolo..'</caption><tr><th rowspan=2>Candidato</th><th rowspan=2 colspan=2>Partito</th><th colspan=2>'
Riga 124 ⟶ 125:
while (args['cand'..num]) do
if (args['voti'..num]) then
dati[num] = {
tot = tot+tonumber(args['voti'..num])
tot2 n = args['cand'..num], v = tonumber(args['voti'..num]), b = tot2+tonumber(args['ball'..num] or 0-1),
p = args['part'..num] or '—', c = args['col'..num]
}
tot = tot+tonumber(argsdati['voti'..num]).v
if (dati[num].b > -1) then tot2 = tot2 + dati[num].b end
else
err = ' - non indicato il numero di voti per il candidato '..num
Riga 137 ⟶ 142:
for i=1,num do
if (i==1) then
ss = ss..string.format('<tr><td align=left><b>%s</b></td><td style="width:0;background:%s"> </td><td align=left>%s</td>', argsdati['cand'..i].n, colora(argsdati['part'..i].p,argsdati['col'..i].c), (argsdati['part'..i] or '—').p)
if (ball>0) then
ss = ss..vrg(argsdati['voti'..i].v,tot,0)
ss = ss..vrg(argsdati['ball'..i].b,tot2,1)
else
ss = ss..vrg(argsdati['voti'..i].v,tot,1)
end
ss = ss..'</tr>'
else
ss = ss..string.format('<tr><td align=left>%s</td><td style="width:0;background:%s"> </td><td align=left>%s</td>', argsdati['cand'..i].n, colora(argsdati['part'..i].p,argsdati['col'..i].c), (argsdati['part'..i] or '—').p)
ss = ss.. vrg(argsdati['voti'..i].v,tot,0)
if (argsdati['ball'..i].b>-1) then ss = ss..vrg(argsdati['ball'..i].b,tot2,0) end
ss = ss..'</tr>'
end
Riga 185 ⟶ 190:
local num = 0
local tot,tot2 = 0,0
local dati = {}
 
ss = '<table class="wikitable" style="text-align:right;margin:10px auto"><caption>'..titolo..'</caption><tr><th rowspan=2>Candidato</th><th rowspan=2 colspan=2>Partito</th><th colspan=2>'
Riga 192 ⟶ 198:
num = 1
while (args['cand'..num]) do
if (not args['voti'..num]) then
dati[num] = {
p = args['cand'..num], v = tonumber(args['voti'..num]), b = tonumber(args['ball'..num] or -1),
p = args['part'..num] or '—', c = args['col'..num]
}
else
err = ' - non indicato il numero di voti per il candidato '..num
end
Riga 204 ⟶ 215:
for i=1,num do
if (i<=eletti) then
ss = ss..string.format('<tr><td align=left><b>%s</b></td><td style="width:0;background:%s"> </td><td align=left>%s</td>', argsdati['cand'..i].n, colora(argsdati['part'..i].p,argsdati['col'..i].c), (argsdati['part'..i] or '—').p)
if (ball>0) then
ss = ss..vrg(argsdati['voti'..i].v,votanti,0)
ss = ss..vrg(argsdati['ball'..i].b,votanti2,1)
else
ss = ss..vrg(argsdati['voti'..i].v,votanti,1)
end
ss =ss..'</tr>'
else
ss = ss..string.format('<tr><td align=left>%s</td><td style="width:0;background:%s"> </td><td align=left>%s</td>', argsdati['cand'..i].n, colora(argsdati['part'..i].p,argsdati['col'..i].c), (argsdati['part'..i] or '—').p)
ss = ss..vrg(argsdati['voti'..i].v,votanti,0)
if (argsdati['ball'..i].b>-1) then ss = ss..vrg(argsdati['ball'..i].b,votanti2,0) end
ss = ss..'</tr>'
end
Riga 251 ⟶ 262:
local num = 0
local tot,tot2 = 0,0
local dati = {}
 
ss = '<table cellpadding=0 cellspacing=0 style="border-collapse:collapse;margin:10px auto"><caption><b>'..titolo..'</b><tr style="vertical-align:top"><td>'
Riga 261 ⟶ 273:
while (args['part'..num]) do
if (args['voti'..num]) then
dati[num] = {
tot = tot+tonumber(args['voti'..num])
tot2 p = args['part'..num], v = tonumber(args['voti'..num]), b = tot2+tonumber(args['ball'..num] or 0-1),
c = args['col'..num], s = args['seggi'..num] or ''
}
tot = tot+tonumber(argsdati['voti'..num]).v
if (dati[num].b > -1) then tot2 = tot2 + dati[num].b end
else
err = ' - non indicato il numero di voti per il partito '..num
end
num = num+1
end
Riga 273 ⟶ 289:
if (err == '-') then
for i=1,num do
ss = ss..string.format('<tr><td style="width:0;background:%s"></td><td align=left>%s</td>', colora(argsdati['part'..i].p,argsdati['col'..i].c), argsdati['part'..i].p)
ss = ss..vrg(argsdati['voti'..i].v,tot,0)
if (ball>0) then
if (argsdati['ball'..i].b>-1) then ss = ss..vrg(argsdati['ball'..i].b,tot2,0) else ss=ss..'<td></td><td></td>' end
end
ss = ss..'<td>'..(argsdati['seggi'..i] or '').s..'</td></tr>'
end
ss = ss..fine(elettori,votanti,tot,ball,elettori2,votanti2,tot2,2,5,1)
Riga 284 ⟶ 300:
num = 1
while (args['el'..num]) do
ss = ss..string.format('<tr><td style="background:%s"> </td><td>%s</td></tr>',colora(dati[args['part el'..num]].p,dati[args['colpart el'..num]].c), args['el'..num])
num = num+1
end