Fossil SCM

cosmetic: ensure that /reports graph bars have a width of at least 1, to avoid that a positive event count has an empty graph bar during low-activity time periods (where active is under 1% of activity relative to the rest of the report).

stephan 2013-10-18 10:30 trunk
Commit 50c08819fbef9d59822b4cd1adb706371d6b8f8e
1 file changed +6 -3
+6 -3
--- src/timeline.c
+++ src/timeline.c
@@ -2097,14 +2097,15 @@
20972097
}
20982098
db_reset(&query);
20992099
while( SQLITE_ROW == db_step(&query) ){
21002100
const char * zTimeframe = db_column_text(&query, 0);
21012101
const int nCount = db_column_int(&query, 1);
2102
- const int nSize = nCount
2102
+ int nSize = nCount
21032103
? (int)(100 * nCount / nMaxEvents)
21042104
: 1;
21052105
showYearTotal = 0;
2106
+ if(!nSize) nSize = 1;
21062107
if(includeMonth){
21072108
/* For Month/year view, add a separator for each distinct year. */
21082109
if(!*zPrevYear ||
21092110
(0!=fossil_strncmp(zPrevYear,zTimeframe,4))){
21102111
showYearTotal = *zPrevYear;
@@ -2231,14 +2232,15 @@
22312232
}
22322233
db_reset(&query);
22332234
while( SQLITE_ROW == db_step(&query) ){
22342235
const char * zUser = db_column_text(&query, 0);
22352236
const int nCount = db_column_int(&query, 1);
2236
- const int nSize = nCount
2237
+ int nSize = nCount
22372238
? (int)(100 * nCount / nMaxEvents)
22382239
: 0;
22392240
if(!nCount) continue /* arguable! Possible? */;
2241
+ else if(!nSize) nSize = 1;
22402242
rowClass = ++nRowNumber % 2;
22412243
nEventTotal += nCount;
22422244
@<tr class='row%d(rowClass)'>
22432245
@ <td>
22442246
@ <a href="?view=bymonth&user=%h(zUser)&type=%c((char)statsReportType)">%h(zUser)</a>
@@ -2347,13 +2349,14 @@
23472349
}
23482350
db_reset(&stWeek);
23492351
while( SQLITE_ROW == db_step(&stWeek) ){
23502352
const char * zWeek = db_column_text(&stWeek,0);
23512353
const int nCount = db_column_int(&stWeek,1);
2352
- const int nSize = nCount
2354
+ int nSize = nCount
23532355
? (int)(100 * nCount / nMaxEvents)
23542356
: 0;
2357
+ if(!nSize) nSize = 1;
23552358
total += nCount;
23562359
cgi_printf("<tr class='row%d'>", ++rowCount % 2 );
23572360
cgi_printf("<td><a href='%s/timeline?yw=%t-%s&n=%d&y=%s",
23582361
g.zTop, zYear, zWeek, nCount,
23592362
statsReportTimelineYFlag);
23602363
--- src/timeline.c
+++ src/timeline.c
@@ -2097,14 +2097,15 @@
2097 }
2098 db_reset(&query);
2099 while( SQLITE_ROW == db_step(&query) ){
2100 const char * zTimeframe = db_column_text(&query, 0);
2101 const int nCount = db_column_int(&query, 1);
2102 const int nSize = nCount
2103 ? (int)(100 * nCount / nMaxEvents)
2104 : 1;
2105 showYearTotal = 0;
 
2106 if(includeMonth){
2107 /* For Month/year view, add a separator for each distinct year. */
2108 if(!*zPrevYear ||
2109 (0!=fossil_strncmp(zPrevYear,zTimeframe,4))){
2110 showYearTotal = *zPrevYear;
@@ -2231,14 +2232,15 @@
2231 }
2232 db_reset(&query);
2233 while( SQLITE_ROW == db_step(&query) ){
2234 const char * zUser = db_column_text(&query, 0);
2235 const int nCount = db_column_int(&query, 1);
2236 const int nSize = nCount
2237 ? (int)(100 * nCount / nMaxEvents)
2238 : 0;
2239 if(!nCount) continue /* arguable! Possible? */;
 
2240 rowClass = ++nRowNumber % 2;
2241 nEventTotal += nCount;
2242 @<tr class='row%d(rowClass)'>
2243 @ <td>
2244 @ <a href="?view=bymonth&user=%h(zUser)&type=%c((char)statsReportType)">%h(zUser)</a>
@@ -2347,13 +2349,14 @@
2347 }
2348 db_reset(&stWeek);
2349 while( SQLITE_ROW == db_step(&stWeek) ){
2350 const char * zWeek = db_column_text(&stWeek,0);
2351 const int nCount = db_column_int(&stWeek,1);
2352 const int nSize = nCount
2353 ? (int)(100 * nCount / nMaxEvents)
2354 : 0;
 
2355 total += nCount;
2356 cgi_printf("<tr class='row%d'>", ++rowCount % 2 );
2357 cgi_printf("<td><a href='%s/timeline?yw=%t-%s&n=%d&y=%s",
2358 g.zTop, zYear, zWeek, nCount,
2359 statsReportTimelineYFlag);
2360
--- src/timeline.c
+++ src/timeline.c
@@ -2097,14 +2097,15 @@
2097 }
2098 db_reset(&query);
2099 while( SQLITE_ROW == db_step(&query) ){
2100 const char * zTimeframe = db_column_text(&query, 0);
2101 const int nCount = db_column_int(&query, 1);
2102 int nSize = nCount
2103 ? (int)(100 * nCount / nMaxEvents)
2104 : 1;
2105 showYearTotal = 0;
2106 if(!nSize) nSize = 1;
2107 if(includeMonth){
2108 /* For Month/year view, add a separator for each distinct year. */
2109 if(!*zPrevYear ||
2110 (0!=fossil_strncmp(zPrevYear,zTimeframe,4))){
2111 showYearTotal = *zPrevYear;
@@ -2231,14 +2232,15 @@
2232 }
2233 db_reset(&query);
2234 while( SQLITE_ROW == db_step(&query) ){
2235 const char * zUser = db_column_text(&query, 0);
2236 const int nCount = db_column_int(&query, 1);
2237 int nSize = nCount
2238 ? (int)(100 * nCount / nMaxEvents)
2239 : 0;
2240 if(!nCount) continue /* arguable! Possible? */;
2241 else if(!nSize) nSize = 1;
2242 rowClass = ++nRowNumber % 2;
2243 nEventTotal += nCount;
2244 @<tr class='row%d(rowClass)'>
2245 @ <td>
2246 @ <a href="?view=bymonth&user=%h(zUser)&type=%c((char)statsReportType)">%h(zUser)</a>
@@ -2347,13 +2349,14 @@
2349 }
2350 db_reset(&stWeek);
2351 while( SQLITE_ROW == db_step(&stWeek) ){
2352 const char * zWeek = db_column_text(&stWeek,0);
2353 const int nCount = db_column_int(&stWeek,1);
2354 int nSize = nCount
2355 ? (int)(100 * nCount / nMaxEvents)
2356 : 0;
2357 if(!nSize) nSize = 1;
2358 total += nCount;
2359 cgi_printf("<tr class='row%d'>", ++rowCount % 2 );
2360 cgi_printf("<td><a href='%s/timeline?yw=%t-%s&n=%d&y=%s",
2361 g.zTop, zYear, zWeek, nCount,
2362 statsReportTimelineYFlag);
2363

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button