Index: src/statrep.c ================================================================== --- src/statrep.c +++ src/statrep.c @@ -334,12 +334,12 @@ all rows. */ stats_report_init_view(); @

Timeline Events @ (%s(stats_report_label_for_type())) by User

db_multi_exec( - "CREATE TEMP TABLE piechart(amt,label);" - "INSERT INTO piechart SELECT count(*), ifnull(euser,user) FROM v_reports" + "CREATE TEMP VIEW piechart(amt,label) AS" + " SELECT count(*), ifnull(euser,user) FROM v_reports" " GROUP BY ifnull(euser,user) ORDER BY count(*) DESC;" ); if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){ @
piechart_render(700, 400, PIE_OTHER|PIE_PERCENT); @@ -482,24 +482,26 @@ if( zUserName ){ @ for user %h(zUserName) } @ db_multi_exec( - "CREATE TEMP TABLE piechart(amt,label);" - "INSERT INTO piechart" - " SELECT count(*), cast(strftime('%%w', mtime) AS INT) FROM v_reports" - " WHERE ifnull(coalesce(euser,user,'')=%Q,1)" - " GROUP BY 2 ORDER BY 2;" - "UPDATE piechart SET label = CASE label" - " WHEN 0 THEN 'Sunday'" - " WHEN 1 THEN 'Monday'" - " WHEN 2 THEN 'Tuesday'" - " WHEN 3 THEN 'Wednesday'" - " WHEN 4 THEN 'Thursday'" - " WHEN 5 THEN 'Friday'" - " WHEN 6 THEN 'Saturday'" - " ELSE 'ERROR' END;", zUserName + "CREATE TEMP VIEW piechart(amt,label) AS" + " SELECT count(*)," + " CASE cast(strftime('%%w', mtime) AS INT)" + " WHEN 0 THEN 'Sunday'" + " WHEN 1 THEN 'Monday'" + " WHEN 2 THEN 'Tuesday'" + " WHEN 3 THEN 'Wednesday'" + " WHEN 4 THEN 'Thursday'" + " WHEN 5 THEN 'Friday'" + " WHEN 6 THEN 'Saturday'" + " ELSE 'ERROR'" + " END" + " FROM v_reports" + " WHERE ifnull(coalesce(euser,user,'')=%Q,1)" + " GROUP BY 2 ORDER BY cast(strftime('%%w', mtime) AS INT);" + , zUserName ); if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){ @
piechart_render(700, 400, PIE_OTHER|PIE_PERCENT); @