Fossil SCM

Fix the day-of-week activity report to be more accurate. Also fix a crash bug that occurs when trying to run "fossil ui" on a fresh repo.

drh 2015-08-12 00:51 trunk
Commit e747dd856379344e7b53118c613610af2ec683ce
2 files changed +1 -1 +12 -11
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -1050,11 +1050,11 @@
10501050
10511051
/* If no match is found and the name begins with an upper-case
10521052
** letter, then check to see if there is an environment variable
10531053
** with the given name.
10541054
*/
1055
- if( fossil_isupper(zName[0]) ){
1055
+ if( zName && fossil_isupper(zName[0]) ){
10561056
const char *zValue = fossil_getenv(zName);
10571057
if( zValue ){
10581058
cgi_set_parameter_nocopy(zName, zValue, 0);
10591059
CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
10601060
return zValue;
10611061
--- src/cgi.c
+++ src/cgi.c
@@ -1050,11 +1050,11 @@
1050
1051 /* If no match is found and the name begins with an upper-case
1052 ** letter, then check to see if there is an environment variable
1053 ** with the given name.
1054 */
1055 if( fossil_isupper(zName[0]) ){
1056 const char *zValue = fossil_getenv(zName);
1057 if( zValue ){
1058 cgi_set_parameter_nocopy(zName, zValue, 0);
1059 CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
1060 return zValue;
1061
--- src/cgi.c
+++ src/cgi.c
@@ -1050,11 +1050,11 @@
1050
1051 /* If no match is found and the name begins with an upper-case
1052 ** letter, then check to see if there is an environment variable
1053 ** with the given name.
1054 */
1055 if( zName && fossil_isupper(zName[0]) ){
1056 const char *zValue = fossil_getenv(zName);
1057 if( zValue ){
1058 cgi_set_parameter_nocopy(zName, zValue, 0);
1059 CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
1060 return zValue;
1061
+12 -11
--- src/statrep.c
+++ src/statrep.c
@@ -462,20 +462,20 @@
462462
row colors */
463463
int nMaxEvents = 1; /* max number of events for
464464
all rows. */
465465
Blob userFilter = empty_blob; /* Optional user=johndoe query string */
466466
static const char *const daysOfWeek[] = {
467
- "Monday", "Tuesday", "Wednesday", "Thursday",
468
- "Friday", "Saturday", "Sunday"
467
+ "Sunday", "Monday", "Tuesday", "Wednesday",
468
+ "Thursday", "Friday", "Saturday"
469469
};
470470
471471
stats_report_init_view();
472472
if( zUserName ){
473473
blob_appendf(&userFilter, "user=%s", zUserName);
474474
}
475475
db_prepare(&query,
476
- "SELECT cast(mtime %% 7 AS INTEGER) dow,"
476
+ "SELECT cast(strftime('%%w', mtime) AS INTEGER) dow,"
477477
" COUNT(*) AS eventCount"
478478
" FROM v_reports"
479479
" WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
480480
" GROUP BY dow ORDER BY dow", zUserName);
481481
@ <h1>Timeline Events (%h(stats_report_label_for_type())) by Day of the Week
@@ -484,21 +484,22 @@
484484
}
485485
@ </h1>
486486
db_multi_exec(
487487
"CREATE TEMP TABLE piechart(amt,label);"
488488
"INSERT INTO piechart"
489
- " SELECT count(*), cast(mtime %% 7 AS INT) FROM v_reports"
489
+ " SELECT count(*), cast(strftime('%%w', mtime) AS INT) FROM v_reports"
490490
" WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
491491
" GROUP BY 2 ORDER BY 2;"
492492
"UPDATE piechart SET label = CASE label"
493
- " WHEN 0 THEN 'Monday'"
494
- " WHEN 1 THEN 'Tuesday'"
495
- " WHEN 2 THEN 'Wednesday'"
496
- " WHEN 3 THEN 'Thursday'"
497
- " WHEN 4 THEN 'Friday'"
498
- " WHEN 5 THEN 'Saturday'"
499
- " ELSE 'Sunday' END;", zUserName
493
+ " WHEN 0 THEN 'Sunday'"
494
+ " WHEN 1 THEN 'Monday'"
495
+ " WHEN 2 THEN 'Tuesday'"
496
+ " WHEN 3 THEN 'Wednesday'"
497
+ " WHEN 4 THEN 'Thursday'"
498
+ " WHEN 5 THEN 'Friday'"
499
+ " WHEN 6 THEN 'Saturday'"
500
+ " ELSE 'ERROR' END;", zUserName
500501
);
501502
if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){
502503
@ <center><svg width=700 height=400>
503504
piechart_render(700, 400, PIE_OTHER|PIE_PERCENT);
504505
@ </svg></centre><hr/>
505506
--- src/statrep.c
+++ src/statrep.c
@@ -462,20 +462,20 @@
462 row colors */
463 int nMaxEvents = 1; /* max number of events for
464 all rows. */
465 Blob userFilter = empty_blob; /* Optional user=johndoe query string */
466 static const char *const daysOfWeek[] = {
467 "Monday", "Tuesday", "Wednesday", "Thursday",
468 "Friday", "Saturday", "Sunday"
469 };
470
471 stats_report_init_view();
472 if( zUserName ){
473 blob_appendf(&userFilter, "user=%s", zUserName);
474 }
475 db_prepare(&query,
476 "SELECT cast(mtime %% 7 AS INTEGER) dow,"
477 " COUNT(*) AS eventCount"
478 " FROM v_reports"
479 " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
480 " GROUP BY dow ORDER BY dow", zUserName);
481 @ <h1>Timeline Events (%h(stats_report_label_for_type())) by Day of the Week
@@ -484,21 +484,22 @@
484 }
485 @ </h1>
486 db_multi_exec(
487 "CREATE TEMP TABLE piechart(amt,label);"
488 "INSERT INTO piechart"
489 " SELECT count(*), cast(mtime %% 7 AS INT) FROM v_reports"
490 " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
491 " GROUP BY 2 ORDER BY 2;"
492 "UPDATE piechart SET label = CASE label"
493 " WHEN 0 THEN 'Monday'"
494 " WHEN 1 THEN 'Tuesday'"
495 " WHEN 2 THEN 'Wednesday'"
496 " WHEN 3 THEN 'Thursday'"
497 " WHEN 4 THEN 'Friday'"
498 " WHEN 5 THEN 'Saturday'"
499 " ELSE 'Sunday' END;", zUserName
 
500 );
501 if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){
502 @ <center><svg width=700 height=400>
503 piechart_render(700, 400, PIE_OTHER|PIE_PERCENT);
504 @ </svg></centre><hr/>
505
--- src/statrep.c
+++ src/statrep.c
@@ -462,20 +462,20 @@
462 row colors */
463 int nMaxEvents = 1; /* max number of events for
464 all rows. */
465 Blob userFilter = empty_blob; /* Optional user=johndoe query string */
466 static const char *const daysOfWeek[] = {
467 "Sunday", "Monday", "Tuesday", "Wednesday",
468 "Thursday", "Friday", "Saturday"
469 };
470
471 stats_report_init_view();
472 if( zUserName ){
473 blob_appendf(&userFilter, "user=%s", zUserName);
474 }
475 db_prepare(&query,
476 "SELECT cast(strftime('%%w', mtime) AS INTEGER) dow,"
477 " COUNT(*) AS eventCount"
478 " FROM v_reports"
479 " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
480 " GROUP BY dow ORDER BY dow", zUserName);
481 @ <h1>Timeline Events (%h(stats_report_label_for_type())) by Day of the Week
@@ -484,21 +484,22 @@
484 }
485 @ </h1>
486 db_multi_exec(
487 "CREATE TEMP TABLE piechart(amt,label);"
488 "INSERT INTO piechart"
489 " SELECT count(*), cast(strftime('%%w', mtime) AS INT) FROM v_reports"
490 " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
491 " GROUP BY 2 ORDER BY 2;"
492 "UPDATE piechart SET label = CASE label"
493 " WHEN 0 THEN 'Sunday'"
494 " WHEN 1 THEN 'Monday'"
495 " WHEN 2 THEN 'Tuesday'"
496 " WHEN 3 THEN 'Wednesday'"
497 " WHEN 4 THEN 'Thursday'"
498 " WHEN 5 THEN 'Friday'"
499 " WHEN 6 THEN 'Saturday'"
500 " ELSE 'ERROR' END;", zUserName
501 );
502 if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){
503 @ <center><svg width=700 height=400>
504 piechart_render(700, 400, PIE_OTHER|PIE_PERCENT);
505 @ </svg></centre><hr/>
506

Keyboard Shortcuts

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