Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fb85d81

Browse files
author
David Kobia
committedDec 7, 2009
* Fixed issue with category in remote stats non-existent in local DB
* closes ushahidi#207 * Added missing DB version update
1 parent 7a41db7 commit fb85d81

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed
 

‎application/controllers/reports.php

+23-19
Original file line numberDiff line numberDiff line change
@@ -154,26 +154,30 @@ public function index()
154154
$report_data = array();
155155
$tick_string_array = array();
156156
foreach($data['category_counts'] as $category_id => $count_array) {
157-
$category_name = $cats[$category_id]['category_title'];
158-
$colors[$category_name] = $cats[$category_id]['category_color'];
159-
$i = 1;
160-
foreach($count_array as $time => $count){
161-
162-
$report_data[$category_name][$i] = $count;
163-
164-
// The highest count will determine the number of ticks on the y-axis
165-
if($count > $highest_count) {
166-
$highest_count = $count;
167-
}
168-
169-
// This statement sets us up so we can convert the key to a date
170-
if(!isset($tick_represents[$i])) {
171-
$tick_represents[$i] = $time;
172-
// Save name
173-
$tick_string_array[$i] = date('M d',$time);
157+
// Does this category exist locally any more?
158+
if (isset($cats[$category_id]))
159+
{
160+
$category_name = $cats[$category_id]['category_title'];
161+
$colors[$category_name] = $cats[$category_id]['category_color'];
162+
$i = 1;
163+
foreach($count_array as $time => $count){
164+
165+
$report_data[$category_name][$i] = $count;
166+
167+
// The highest count will determine the number of ticks on the y-axis
168+
if($count > $highest_count) {
169+
$highest_count = $count;
170+
}
171+
172+
// This statement sets us up so we can convert the key to a date
173+
if(!isset($tick_represents[$i])) {
174+
$tick_represents[$i] = $time;
175+
// Save name
176+
$tick_string_array[$i] = date('M d',$time);
177+
}
178+
179+
$i++;
174180
}
175-
176-
$i++;
177181
}
178182
}
179183
$highest_count += 1;

‎sql/upgrade20-21.sql

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ CREATE TABLE `layer` (
99
`layer_file` VARCHAR( 100 ) NULL ,
1010
`layer_color` VARCHAR( 20 ) NULL ,
1111
`layer_visible` TINYINT NOT NULL DEFAULT '1'
12-
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
12+
) ENGINE = MYISAM DEFAULT CHARSET=utf8;
13+
14+
15+
UPDATE `settings` SET `db_version` = '21' WHERE `id`=1 LIMIT 1;

0 commit comments

Comments
 (0)
Please sign in to comment.