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).
Commit
50c08819fbef9d59822b4cd1adb706371d6b8f8e
Parent
6cc54a7962b29b7…
1 file changed
+6
-3
+6
-3
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -2097,14 +2097,15 @@ | ||
| 2097 | 2097 | } |
| 2098 | 2098 | db_reset(&query); |
| 2099 | 2099 | while( SQLITE_ROW == db_step(&query) ){ |
| 2100 | 2100 | const char * zTimeframe = db_column_text(&query, 0); |
| 2101 | 2101 | const int nCount = db_column_int(&query, 1); |
| 2102 | - const int nSize = nCount | |
| 2102 | + int nSize = nCount | |
| 2103 | 2103 | ? (int)(100 * nCount / nMaxEvents) |
| 2104 | 2104 | : 1; |
| 2105 | 2105 | showYearTotal = 0; |
| 2106 | + if(!nSize) nSize = 1; | |
| 2106 | 2107 | if(includeMonth){ |
| 2107 | 2108 | /* For Month/year view, add a separator for each distinct year. */ |
| 2108 | 2109 | if(!*zPrevYear || |
| 2109 | 2110 | (0!=fossil_strncmp(zPrevYear,zTimeframe,4))){ |
| 2110 | 2111 | showYearTotal = *zPrevYear; |
| @@ -2231,14 +2232,15 @@ | ||
| 2231 | 2232 | } |
| 2232 | 2233 | db_reset(&query); |
| 2233 | 2234 | while( SQLITE_ROW == db_step(&query) ){ |
| 2234 | 2235 | const char * zUser = db_column_text(&query, 0); |
| 2235 | 2236 | const int nCount = db_column_int(&query, 1); |
| 2236 | - const int nSize = nCount | |
| 2237 | + int nSize = nCount | |
| 2237 | 2238 | ? (int)(100 * nCount / nMaxEvents) |
| 2238 | 2239 | : 0; |
| 2239 | 2240 | if(!nCount) continue /* arguable! Possible? */; |
| 2241 | + else if(!nSize) nSize = 1; | |
| 2240 | 2242 | rowClass = ++nRowNumber % 2; |
| 2241 | 2243 | nEventTotal += nCount; |
| 2242 | 2244 | @<tr class='row%d(rowClass)'> |
| 2243 | 2245 | @ <td> |
| 2244 | 2246 | @ <a href="?view=bymonth&user=%h(zUser)&type=%c((char)statsReportType)">%h(zUser)</a> |
| @@ -2347,13 +2349,14 @@ | ||
| 2347 | 2349 | } |
| 2348 | 2350 | db_reset(&stWeek); |
| 2349 | 2351 | while( SQLITE_ROW == db_step(&stWeek) ){ |
| 2350 | 2352 | const char * zWeek = db_column_text(&stWeek,0); |
| 2351 | 2353 | const int nCount = db_column_int(&stWeek,1); |
| 2352 | - const int nSize = nCount | |
| 2354 | + int nSize = nCount | |
| 2353 | 2355 | ? (int)(100 * nCount / nMaxEvents) |
| 2354 | 2356 | : 0; |
| 2357 | + if(!nSize) nSize = 1; | |
| 2355 | 2358 | total += nCount; |
| 2356 | 2359 | cgi_printf("<tr class='row%d'>", ++rowCount % 2 ); |
| 2357 | 2360 | cgi_printf("<td><a href='%s/timeline?yw=%t-%s&n=%d&y=%s", |
| 2358 | 2361 | g.zTop, zYear, zWeek, nCount, |
| 2359 | 2362 | statsReportTimelineYFlag); |
| 2360 | 2363 |
| --- 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 |