Fossil SCM

Deal with the fact that the Fossil repository has a few null users. Instead of having them match everything, including nonexistent users, make them match nothing.

andygoth 2015-05-18 02:36 UTC andygoth-user-reports
Commit cbbee17312070895347430f81784e81d142441dd
1 file changed +6 -6
+6 -6
--- src/statrep.c
+++ src/statrep.c
@@ -262,11 +262,11 @@
262262
blob_reset(&userFilter);
263263
db_prepare(&query,
264264
"SELECT substr(date(mtime),1,%d) AS timeframe,"
265265
" count(*) AS eventCount"
266266
" FROM v_reports"
267
- " WHERE ifnull(user=%Q,1)"
267
+ " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
268268
" GROUP BY timeframe"
269269
" ORDER BY timeframe DESC",
270270
includeMonth ? 7 : 4, zUserName);
271271
@ <h1>Timeline Events (%s(stats_report_label_for_type()))
272272
@ by year%s(includeMonth ? "/month" : "")
@@ -478,11 +478,11 @@
478478
"INSERT INTO statrep(filename, cnt)"
479479
" SELECT filename.name, count(distinct mlink.mid)"
480480
" FROM filename, mlink, event"
481481
" WHERE filename.fnid=mlink.fnid"
482482
" AND mlink.mid=event.objid"
483
- " AND ifnull(ifnull(euser,user)=%Q,1)"
483
+ " AND ifnull(coalesce(euser,user,'')=%Q,1)"
484484
" GROUP BY 1", zUserName
485485
);
486486
db_prepare(&query,
487487
"SELECT filename, cnt FROM statrep ORDER BY cnt DESC, filename /*sort*/"
488488
);
@@ -545,21 +545,21 @@
545545
stats_report_event_types_menu("byweekday", blob_str(&userFilter));
546546
db_prepare(&query,
547547
"SELECT cast(mtime %% 7 AS INTEGER) dow,"
548548
" COUNT(*) AS eventCount"
549549
" FROM v_reports"
550
- " WHERE ifnull(ifnull(euser,user)=%Q,1)"
550
+ " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
551551
" GROUP BY dow ORDER BY dow", zUserName);
552552
@ <h1>Timeline Events (%h(stats_report_label_for_type())) by Day of the Week
553553
if( zUserName ){
554554
@ for user %h(zUserName)
555555
}
556556
@ </h1>
557557
db_multi_exec(
558558
"CREATE TEMP TABLE piechart(amt,label);"
559559
"INSERT INTO piechart SELECT count(*), cast(mtime %% 7 AS INT) FROM v_reports"
560
- " WHERE ifnull(ifnull(euser,user)=%Q,1)"
560
+ " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
561561
" GROUP BY 2 ORDER BY 2;"
562562
"UPDATE piechart SET label = CASE label WHEN 0 THEN 'Monday' WHEN 1 THEN 'Tuesday'"
563563
" WHEN 2 THEN 'Wednesday' WHEN 3 THEN 'Thursday' WHEN 4 THEN 'Friday'"
564564
" WHEN 5 THEN 'Saturday' ELSE 'Sunday' END;", zUserName
565565
);
@@ -636,11 +636,11 @@
636636
stats_report_event_types_menu("byweek", blob_str(&urlParams));
637637
blob_reset(&urlParams);
638638
db_prepare(&qYears,
639639
"SELECT DISTINCT substr(date(mtime),1,4) AS y"
640640
" FROM v_reports"
641
- " WHERE ifnull(ifnull(euser,user)=%Q,1)"
641
+ " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
642642
" GROUP BY y ORDER BY y", zUserName);
643643
cgi_printf("Select year: ");
644644
while( SQLITE_ROW == db_step(&qYears) ){
645645
const char *zT = db_column_text(&qYears, 0);
646646
if( i++ ){
@@ -668,11 +668,11 @@
668668
"SELECT DISTINCT strftime('%%W',mtime) AS wk, "
669669
" count(*) AS n "
670670
" FROM v_reports "
671671
" WHERE %Q=substr(date(mtime),1,4) "
672672
" AND mtime < current_timestamp "
673
- " AND ifnull(ifnull(euser,user)=%Q,1)"
673
+ " AND ifnull(coalesce(euser,user,'')=%Q,1)"
674674
" GROUP BY wk ORDER BY wk DESC", zYear, zUserName);
675675
@ <h1>Timeline events (%h(stats_report_label_for_type()))
676676
@ for the calendar weeks of %h(zYear)
677677
if( zUserName ){
678678
@ for user %h(zUserName)
679679
--- src/statrep.c
+++ src/statrep.c
@@ -262,11 +262,11 @@
262 blob_reset(&userFilter);
263 db_prepare(&query,
264 "SELECT substr(date(mtime),1,%d) AS timeframe,"
265 " count(*) AS eventCount"
266 " FROM v_reports"
267 " WHERE ifnull(user=%Q,1)"
268 " GROUP BY timeframe"
269 " ORDER BY timeframe DESC",
270 includeMonth ? 7 : 4, zUserName);
271 @ <h1>Timeline Events (%s(stats_report_label_for_type()))
272 @ by year%s(includeMonth ? "/month" : "")
@@ -478,11 +478,11 @@
478 "INSERT INTO statrep(filename, cnt)"
479 " SELECT filename.name, count(distinct mlink.mid)"
480 " FROM filename, mlink, event"
481 " WHERE filename.fnid=mlink.fnid"
482 " AND mlink.mid=event.objid"
483 " AND ifnull(ifnull(euser,user)=%Q,1)"
484 " GROUP BY 1", zUserName
485 );
486 db_prepare(&query,
487 "SELECT filename, cnt FROM statrep ORDER BY cnt DESC, filename /*sort*/"
488 );
@@ -545,21 +545,21 @@
545 stats_report_event_types_menu("byweekday", blob_str(&userFilter));
546 db_prepare(&query,
547 "SELECT cast(mtime %% 7 AS INTEGER) dow,"
548 " COUNT(*) AS eventCount"
549 " FROM v_reports"
550 " WHERE ifnull(ifnull(euser,user)=%Q,1)"
551 " GROUP BY dow ORDER BY dow", zUserName);
552 @ <h1>Timeline Events (%h(stats_report_label_for_type())) by Day of the Week
553 if( zUserName ){
554 @ for user %h(zUserName)
555 }
556 @ </h1>
557 db_multi_exec(
558 "CREATE TEMP TABLE piechart(amt,label);"
559 "INSERT INTO piechart SELECT count(*), cast(mtime %% 7 AS INT) FROM v_reports"
560 " WHERE ifnull(ifnull(euser,user)=%Q,1)"
561 " GROUP BY 2 ORDER BY 2;"
562 "UPDATE piechart SET label = CASE label WHEN 0 THEN 'Monday' WHEN 1 THEN 'Tuesday'"
563 " WHEN 2 THEN 'Wednesday' WHEN 3 THEN 'Thursday' WHEN 4 THEN 'Friday'"
564 " WHEN 5 THEN 'Saturday' ELSE 'Sunday' END;", zUserName
565 );
@@ -636,11 +636,11 @@
636 stats_report_event_types_menu("byweek", blob_str(&urlParams));
637 blob_reset(&urlParams);
638 db_prepare(&qYears,
639 "SELECT DISTINCT substr(date(mtime),1,4) AS y"
640 " FROM v_reports"
641 " WHERE ifnull(ifnull(euser,user)=%Q,1)"
642 " GROUP BY y ORDER BY y", zUserName);
643 cgi_printf("Select year: ");
644 while( SQLITE_ROW == db_step(&qYears) ){
645 const char *zT = db_column_text(&qYears, 0);
646 if( i++ ){
@@ -668,11 +668,11 @@
668 "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
669 " count(*) AS n "
670 " FROM v_reports "
671 " WHERE %Q=substr(date(mtime),1,4) "
672 " AND mtime < current_timestamp "
673 " AND ifnull(ifnull(euser,user)=%Q,1)"
674 " GROUP BY wk ORDER BY wk DESC", zYear, zUserName);
675 @ <h1>Timeline events (%h(stats_report_label_for_type()))
676 @ for the calendar weeks of %h(zYear)
677 if( zUserName ){
678 @ for user %h(zUserName)
679
--- src/statrep.c
+++ src/statrep.c
@@ -262,11 +262,11 @@
262 blob_reset(&userFilter);
263 db_prepare(&query,
264 "SELECT substr(date(mtime),1,%d) AS timeframe,"
265 " count(*) AS eventCount"
266 " FROM v_reports"
267 " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
268 " GROUP BY timeframe"
269 " ORDER BY timeframe DESC",
270 includeMonth ? 7 : 4, zUserName);
271 @ <h1>Timeline Events (%s(stats_report_label_for_type()))
272 @ by year%s(includeMonth ? "/month" : "")
@@ -478,11 +478,11 @@
478 "INSERT INTO statrep(filename, cnt)"
479 " SELECT filename.name, count(distinct mlink.mid)"
480 " FROM filename, mlink, event"
481 " WHERE filename.fnid=mlink.fnid"
482 " AND mlink.mid=event.objid"
483 " AND ifnull(coalesce(euser,user,'')=%Q,1)"
484 " GROUP BY 1", zUserName
485 );
486 db_prepare(&query,
487 "SELECT filename, cnt FROM statrep ORDER BY cnt DESC, filename /*sort*/"
488 );
@@ -545,21 +545,21 @@
545 stats_report_event_types_menu("byweekday", blob_str(&userFilter));
546 db_prepare(&query,
547 "SELECT cast(mtime %% 7 AS INTEGER) dow,"
548 " COUNT(*) AS eventCount"
549 " FROM v_reports"
550 " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
551 " GROUP BY dow ORDER BY dow", zUserName);
552 @ <h1>Timeline Events (%h(stats_report_label_for_type())) by Day of the Week
553 if( zUserName ){
554 @ for user %h(zUserName)
555 }
556 @ </h1>
557 db_multi_exec(
558 "CREATE TEMP TABLE piechart(amt,label);"
559 "INSERT INTO piechart SELECT count(*), cast(mtime %% 7 AS INT) FROM v_reports"
560 " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
561 " GROUP BY 2 ORDER BY 2;"
562 "UPDATE piechart SET label = CASE label WHEN 0 THEN 'Monday' WHEN 1 THEN 'Tuesday'"
563 " WHEN 2 THEN 'Wednesday' WHEN 3 THEN 'Thursday' WHEN 4 THEN 'Friday'"
564 " WHEN 5 THEN 'Saturday' ELSE 'Sunday' END;", zUserName
565 );
@@ -636,11 +636,11 @@
636 stats_report_event_types_menu("byweek", blob_str(&urlParams));
637 blob_reset(&urlParams);
638 db_prepare(&qYears,
639 "SELECT DISTINCT substr(date(mtime),1,4) AS y"
640 " FROM v_reports"
641 " WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
642 " GROUP BY y ORDER BY y", zUserName);
643 cgi_printf("Select year: ");
644 while( SQLITE_ROW == db_step(&qYears) ){
645 const char *zT = db_column_text(&qYears, 0);
646 if( i++ ){
@@ -668,11 +668,11 @@
668 "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
669 " count(*) AS n "
670 " FROM v_reports "
671 " WHERE %Q=substr(date(mtime),1,4) "
672 " AND mtime < current_timestamp "
673 " AND ifnull(coalesce(euser,user,'')=%Q,1)"
674 " GROUP BY wk ORDER BY wk DESC", zYear, zUserName);
675 @ <h1>Timeline events (%h(stats_report_label_for_type()))
676 @ for the calendar weeks of %h(zYear)
677 if( zUserName ){
678 @ for user %h(zUserName)
679

Keyboard Shortcuts

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