Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
87 righe
3.6 KiB
87 righe
3.6 KiB
<? |
|
|
|
if (isset($this) && is_a($this,"gara") && isset($settings)) { |
|
$partecipanti = $this->getPartecipantiForAnomalia(); |
|
usort($partecipanti,"sortPartecipantiTotale"); |
|
if (!empty($partecipanti)) { |
|
$numero_partecipanti = count($partecipanti); |
|
$infoAnomalia = []; |
|
|
|
$algoritmi = []; |
|
$algoritmi[] = "a"; |
|
$algoritmi[] = "b"; |
|
$algoritmi[] = "c"; |
|
$algoritmi[] = "d"; |
|
$algoritmi[] = "e"; |
|
$coefficienti = []; |
|
$coefficienti[] = "0.6"; |
|
$coefficienti[] = "0.7"; |
|
$coefficienti[] = "0.8"; |
|
$coefficienti[] = "0.9"; |
|
if ($settings["lettera"] == "z") { |
|
shuffle($algoritmi); |
|
$selezione = rand(0,4); |
|
$settings["lettera"] = $algoritmi[$selezione]; |
|
$infoAnomalia["sequenza_sorteggio_lettera"] = json_encode($algoritmi); |
|
$infoAnomalia["selezione_sorteggio_lettera"] = json_encode($selezione); |
|
} |
|
if ($settings["lettera"] === "e" && $settings["coefficiente"] == "z") { |
|
shuffle($coefficienti); |
|
$selezione = rand(0,4); |
|
$settings["coefficiente"] = $coefficienti[$selezione]; |
|
$infoAnomalia["sequenza_sorteggio_coefficiente"] = json_encode($coefficienti); |
|
$infoAnomalia["selezione_sorteggio_coefficiente"] = json_encode($selezione); |
|
} |
|
if (in_array($settings["lettera"],$algoritmi) !== false) { |
|
$esclusione_automatica = $this->getRisposteElaborazione()["esclusioneAutomatica"] ?? "N"; |
|
if ($esclusione_automatica == "S") { |
|
$esclusione_automatica = true; |
|
if ($numero_partecipanti <= 10 || (strpos($this->info["tipologia"],"L") !== false && $this->info["prezzoRiferimento"] >= 5548000) || (strpos($this->info["tipologia"],"L") === false && $this->info["prezzoRiferimento"] >= 221000)) { |
|
$esclusione_automatica = false; |
|
} |
|
} else { |
|
$esclusione_automatica = false; |
|
} |
|
$path = __DIR__."/" . substr($settings["lettera"],0,1) . ".php"; |
|
if (file_exists($path)) { |
|
include($path); |
|
if (isset($soglia_anomalia)) { |
|
$infoAnomalia["esclusione_automatica"] = $esclusione_automatica; |
|
$extraInfo = ["set-anomalia-{$this->round["codice"]}"=>json_encode($settings,JSON_PRETTY_PRINT),"info-anomalia-{$this->round["codice"]}"=>json_encode($infoAnomalia,JSON_PRETTY_PRINT)]; |
|
reset($partecipanti); |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "r_partecipanti_gare"; |
|
$salva->operazione = "UPDATE"; |
|
foreach($partecipanti AS $partecipante) { |
|
if ($partecipante["totale"] >= $soglia_anomalia) { |
|
$partecipante["anomalia"] = "S"; |
|
$partecipante["a_facoltativa"] = "N"; |
|
$partecipante["motivazione_anomalia"] = "Calcolo automatico"; |
|
if ($esclusione_automatica) { |
|
$partecipante["escluso"] = "S"; |
|
$partecipante["esclusione_automatica"] = "S"; |
|
$partecipante["motivazione"] = "Calcolo automatico anomalia"; |
|
} |
|
$salva->oggetto = $partecipante; |
|
$salva->save(); |
|
} |
|
} |
|
$errors = ""; |
|
} else { |
|
if (empty($errors)) { |
|
$errors = __("Errore nel calcolo dell'anomalia"); |
|
} |
|
} |
|
} else { |
|
$errors = __("Algoritmo di calcolo non trovato"); |
|
} |
|
} else { |
|
$errors = __("Algoritmo errato"); |
|
} |
|
} else { |
|
$errors = __("Nessun partecipante ammesso"); |
|
} |
|
} |
|
?>
|