Rev 1621 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
/**
* Script de mise à jour de la table "del_image_stat"
* @author mathias
*/
class Stats extends DelScript {
public function executer() {
$this->majStats();
}
/**
* Met à jour la table des statistiques en la vidant et en recalculant la moyenne pondérée,
* le nombre de votes et le nombre de points pour chaque image - utilise "commun".
* Attention, c'est over-pas-optimisé, ça prend du temps !
*/
protected function majStats() {
$requete = "SELECT id_image FROM del_image ORDER BY id_image ASC";
$ids = $this->getBdd()->recupererTous($requete);
$requete = "SELECT id_protocole FROM del_image_protocole ORDER BY id_protocole ASC";
$protos = $this->getBdd()->recupererTous($requete);
foreach ($ids as $id) {
echo "ID: " . $id['id_image'] . "\n";
foreach ($protos as $proto) {
TelaBotanica\Del\Commun\Stats::updateStats($this->getBdd(), $id['id_image'], $proto['id_protocole']);
}
}
}
}