Skip to content

Commit

Permalink
Make fetch_incidents() date search from beginning till end of day ush…
Browse files Browse the repository at this point in the history
…ahidi#220

This makes sure we still get results if from and to dates are the same.
Also more closely matches what a user would expect
  • Loading branch information
rjmackay committed Oct 24, 2012
1 parent 09b0491 commit 03d324e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions application/helpers/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,9 @@ public static function fetch_incidents($paginate = FALSE, $items_per_page = 0)
//
if (isset($url_data['from']) AND isset($url_data['to']))
{
$date_from = date('Y-m-d', strtotime($url_data['from']));
$date_to = date('Y-m-d', strtotime($url_data['to']));
// Add hours/mins/seconds so we still get reports if from and to are the same day
$date_from = date('Y-m-d 00:00:00', strtotime($url_data['from']));
$date_to = date('Y-m-d 23:59:59', strtotime($url_data['to']));

array_push(self::$params,
'i.incident_date >= "'.$date_from.'"',
Expand Down

3 comments on commit 03d324e

@aoduor
Copy link

@aoduor aoduor commented on 03d324e Nov 5, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjmackay might be a good idea to merge this into core as well :)?

@rjmackay
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well if you feel like doing the code review on this branch I will : ushahidi#872
;)

@rjmackay
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also - reports/download doesn't use fetch_incidents() so we'll have to fix that separately there

Please sign in to comment.