@@ -154,26 +154,30 @@ public function index()
154
154
$ report_data = array ();
155
155
$ tick_string_array = array ();
156
156
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 ++;
174
180
}
175
-
176
- $ i ++;
177
181
}
178
182
}
179
183
$ highest_count += 1 ;
0 commit comments