Fossil

Check-in [37c4fb2249]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More work on the by-week report, but it is (A) way too slow for the by year/month view (4.5 sec on my machine) and (B) bed time again.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | stats-report-weekly
Files: files | file ages | folders
SHA1: 37c4fb2249997c10d0ee884a249a7f11bc93fb10
User & Date: stephan 2013-07-15 22:41:58.654
Context
2013-07-15
22:45
added some docs, removed an unused var, fixed formatting snafu caused by xemacs' confusion regarding the @ bits. ... (check-in: c43c3a7fd2 user: stephan tags: stats-report-weekly)
22:41
More work on the by-week report, but it is (A) way too slow for the by year/month view (4.5 sec on my machine) and (B) bed time again. ... (check-in: 37c4fb2249 user: stephan tags: stats-report-weekly)
22:23
Started work on adding by-calendar-week info to /stats_report. Incomplete but it's bed time. ... (check-in: cced11153b user: stephan tags: stats-report-weekly)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/timeline.c.
1828
1829
1830
1831
1832
1833
1834















1835



1836
1837
1838
1839
1840
1841
1842
    @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&amp;d=%S(zUuid)">%S(zUuid)</a>
  }
  db_finalize(&q);
  style_footer();
}





















/*
** Implements the "byyear" and "bymonth" reports for /stats_report.
** If includeMonth is true then it generates the "bymonth" report,
** else the "byyear" report. If zUserName is not NULL and not empty
** then the report is restricted to events created by the named user
** account.
*/







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>







1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
    @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&amp;d=%S(zUuid)">%S(zUuid)</a>
  }
  db_finalize(&q);
  style_footer();
}


static void stats_report_output_week_links( char const * zTimeframe){
  Blob sqlWeek = empty_blob;
  Stmt stWeek = empty_Stmt;
  db_prepare(&stWeek,
             "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
             "count(*) AS n, "
             "substr(date(mtime),1,%d) AS ym "
             "FROM event "
             "WHERE ym=%Q AND mtime < current_timestamp "
             "GROUP BY wk ORDER BY wk",
             strlen(zTimeframe),
             zTimeframe);
      while( SQLITE_ROW == db_step(&stWeek) ){
        zTimeframe = db_column_text(&stWeek,0);
        @ %s(zTimeframe)
      }
      db_finalize(&stWeek);

}
/*
** Implements the "byyear" and "bymonth" reports for /stats_report.
** If includeMonth is true then it generates the "bymonth" report,
** else the "byyear" report. If zUserName is not NULL and not empty
** then the report is restricted to events created by the named user
** account.
*/
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
    }
    @ </td><td>%d(nCount)</td>
    @ <td>
    @ <div class='statistics-report-graph-line'
    @  style='height:16px;width:%d(nSize)px;'>
    @ </div></td>
    @</tr>
    if(!includeMonth){
      Blob sqlWeek = empty_blob;
      Stmt stWeek = empty_Stmt;
      db_prepare(&stWeek,
                 "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
                 "count(*) AS n, "
                 "substr(date(mtime),1,4) AS ym "
                 "FROM event "
                 "WHERE ym=%Q AND mtime < current_timestamp "
                 "GROUP BY wk ORDER BY wk",
                 zTimeframe);
      @ <tr><td colspan='2' valign='right'>Week #:</td>
      @ <td class='statistics-report-week-of-year-list'>
      while( SQLITE_ROW == db_step(&stWeek) ){
        zTimeframe = db_column_text(&stWeek,0);
        @ %s(zTimeframe)
      }
      @ </td></tr>
      db_finalize(&stWeek);
    }

    /*
      Potential improvement: calculate the min/max event counts and
      use percent-based graph bars.
    */
  }








<
<
<
<
<
<
<
<
<
<
<
|
|
<
<
|
<
|
<
<







1951
1952
1953
1954
1955
1956
1957











1958
1959


1960

1961


1962
1963
1964
1965
1966
1967
1968
    }
    @ </td><td>%d(nCount)</td>
    @ <td>
    @ <div class='statistics-report-graph-line'
    @  style='height:16px;width:%d(nSize)px;'>
    @ </div></td>
    @</tr>











    @ <tr><td colspan='2' class='statistics-report-week-number-label'>Week #:</td>
    @ <td class='statistics-report-week-of-year-list'>


    stats_report_output_week_links(zTimeframe);

    @ </td></tr>



    /*
      Potential improvement: calculate the min/max event counts and
      use percent-based graph bars.
    */
  }