From: Vsevolod Stakhov Date: Sat, 2 Jul 2016 12:18:18 +0000 (+0100) Subject: [Fix] Fix rows calculation in graph X-Git-Tag: 1.3.0~192 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=be8b548ac0dbb9fb0ee65dbffc2f0ebe14f6cc59;p=rspamd.git [Fix] Fix rows calculation in graph --- diff --git a/src/controller.c b/src/controller.c index 486957375..b45e5add5 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1170,7 +1170,8 @@ rspamd_controller_handle_graph ( step = (rrd_result->rra_rows / desired_points + 0.5); acc = g_malloc0 (sizeof (double) * rrd_result->ds_count * step); - for (i = start_row, cnt = 0; cnt < rrd_result->rra_rows; cnt ++) { + for (i = start_row, cnt = 0; cnt < rrd_result->rra_rows; + cnt ++) { for (j = 0; j < rrd_result->ds_count; j++) { if (k < step) { /* Just update window */ @@ -1187,7 +1188,13 @@ rspamd_controller_handle_graph ( } } - i = start_row == 0 ? i + 1 : (i + 1) % start_row; + if (i == rrd_result->rra_rows - 1) { + i = 0; + } + else { + i ++; + } + ts ++; }