Changeset 2403


Ignore:
Timestamp:
Oct 18, 2011, 1:32:48 AM (9 years ago)
Author:
komodo
Message:

probleme dates QO sur plots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpc/branches/senat/project/apps/frontend/modules/plot/actions/components.class.php

    r2373 r2403  
    123123*/
    124124    $query3 = Doctrine_Query::create()
    125       ->select('COUNT(q.id) AS nombre, YEAR(q.date) as annee, WEEKOFYEAR(q.date) as numero_semaine')
     125      ->select('COUNT(q.id) AS nombre, YEAR(IF(ISNULL(q.date_cloture),q.date, greatest(q.date, q.date_cloture))) as annee, WEEKOFYEAR(IF(ISNULL(q.date_cloture),q.date, greatest(q.date, q.date_cloture))) as numero_semaine')
    126126      ->from('Question q')
    127127      ->where('q.type != ?', 'Question écrite')
    128128      ->andWhere('q.parlementaire_id = ?', $this->parlementaire->id)
    129129      ->andWhere('q.reponse != ?', '')
    130       ->andWhere('q.date >= ?', $date_debut)
    131       ->andWhere('q.date < ?', $date_fin)
     130      ->andWhere('IF(ISNULL(q.date_cloture),q.date, greatest(q.date, q.date_cloture)) >= ?', $date_debut)
     131      ->andWhere('IF(ISNULL(q.date_cloture),q.date, greatest(q.date, q.date_cloture)) < ?', $date_fin)
    132132      ->groupBy('annee, numero_semaine');
    133133    $questionsorales = $query3->fetchArray();
Note: See TracChangeset for help on using the changeset viewer.