Skip to content

Commit

Permalink
handle case of scrutins with only votes pour for motions de censure
Browse files Browse the repository at this point in the history
votes 1114 & 1115
cf #115
  • Loading branch information
RouxRC committed Oct 2, 2018
1 parent 1d50daa commit b8aa0cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/model/doctrine/Scrutin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function tagIntervention() {
$inters = Doctrine::getTable('Intervention')
->createQuery('i')
->where('i.seance_id = ?', $this->seance_id)
->andWhere("i.intervention LIKE '%nombre de votants%suffrages exprimés%pour%contre%'")
->andWhere("i.intervention LIKE '%nombre de votants%suffrages exprimés%pour%contre%' OR i.intervention LIKE '%Majorité requise pour l\'adoption%pour l\'adoption%'")
// ->andWhere("i.intervention LIKE '%table class=\"scrutin\"%'")
->orderBy('i.timestamp')
->execute();
Expand All @@ -53,7 +53,11 @@ public function tagIntervention() {
$mp = preg_match_all('/pour l\'(?:adoption|approbation)(?:<\/td><td>|[,\s]*)(\d+)/i', $text, $match_pour);
$mc = preg_match_all('/contre(?:<\/td><td>|[,\s])(\d+)/i', $text, $match_contre);

if ($mv == 0 || $mp == 0 || $mc == 0) {
if (preg_match("/Majorité requise pour l'adoption/", $text) && $mp != 0 && intval(end($match_pour[1])) == $this->nombre_votants && intval(end($match_pour[1])) == $this->nombre_pours) {
$found = TRUE;
$inter->addTag("scrutin:numero={$this->numero}");
break;
} elseif ($mv == 0 || $mp == 0 || $mc == 0) {
echo "WARNING: décomptes intervention {$inter->id} incomplets :\n$text\n";
} elseif (intval(end($match_votant[1])) != $this->nombre_votants
|| intval(end($match_pour[1])) != $this->nombre_pours
Expand Down
2 changes: 1 addition & 1 deletion lib/task/loadScrutinsTask.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected function execute($arguments = array(), $options = array())
->createQuery("i")
->select("count(1) as cnt")
->where("i.seance_id = ?", $seance->id)
->andWhere("i.intervention LIKE '%nombre de votants%suffrages exprimés%pour%contre%'")
->andWhere("i.intervention LIKE '%nombre de votants%suffrages exprimés%pour%contre%' OR i.intervention LIKE '%Majorité requise pour l\'adoption%pour l\'adoption%'")
// ->andWhere("i.intervention LIKE '%<table class=\"scrutin%'")
->fetchOne()['cnt'];

Expand Down

0 comments on commit b8aa0cc

Please sign in to comment.