Fossil SCM

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.

stephan 2013-07-15 22:41 UTC stats-report-weekly
Commit 37c4fb2249997c10d0ee884a249a7f11bc93fb10
1 file changed +22 -20
+22 -20
--- src/timeline.c
+++ src/timeline.c
@@ -1830,11 +1830,29 @@
18301830
db_finalize(&q);
18311831
style_footer();
18321832
}
18331833
18341834
1835
+static void stats_report_output_week_links( char const * zTimeframe){
1836
+ Blob sqlWeek = empty_blob;
1837
+ Stmt stWeek = empty_Stmt;
1838
+ db_prepare(&stWeek,
1839
+ "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
1840
+ "count(*) AS n, "
1841
+ "substr(date(mtime),1,%d) AS ym "
1842
+ "FROM event "
1843
+ "WHERE ym=%Q AND mtime < current_timestamp "
1844
+ "GROUP BY wk ORDER BY wk",
1845
+ strlen(zTimeframe),
1846
+ zTimeframe);
1847
+ while( SQLITE_ROW == db_step(&stWeek) ){
1848
+ zTimeframe = db_column_text(&stWeek,0);
1849
+ @ %s(zTimeframe)
1850
+ }
1851
+ db_finalize(&stWeek);
18351852
1853
+}
18361854
/*
18371855
** Implements the "byyear" and "bymonth" reports for /stats_report.
18381856
** If includeMonth is true then it generates the "bymonth" report,
18391857
** else the "byyear" report. If zUserName is not NULL and not empty
18401858
** then the report is restricted to events created by the named user
@@ -1935,30 +1953,14 @@
19351953
@ <td>
19361954
@ <div class='statistics-report-graph-line'
19371955
@ style='height:16px;width:%d(nSize)px;'>
19381956
@ </div></td>
19391957
@</tr>
1940
- if(!includeMonth){
1941
- Blob sqlWeek = empty_blob;
1942
- Stmt stWeek = empty_Stmt;
1943
- db_prepare(&stWeek,
1944
- "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
1945
- "count(*) AS n, "
1946
- "substr(date(mtime),1,4) AS ym "
1947
- "FROM event "
1948
- "WHERE ym=%Q AND mtime < current_timestamp "
1949
- "GROUP BY wk ORDER BY wk",
1950
- zTimeframe);
1951
- @ <tr><td colspan='2' valign='right'>Week #:</td>
1952
- @ <td class='statistics-report-week-of-year-list'>
1953
- while( SQLITE_ROW == db_step(&stWeek) ){
1954
- zTimeframe = db_column_text(&stWeek,0);
1955
- @ %s(zTimeframe)
1956
- }
1957
- @ </td></tr>
1958
- db_finalize(&stWeek);
1959
- }
1958
+ @ <tr><td colspan='2' class='statistics-report-week-number-label'>Week #:</td>
1959
+ @ <td class='statistics-report-week-of-year-list'>
1960
+ stats_report_output_week_links(zTimeframe);
1961
+ @ </td></tr>
19601962
19611963
/*
19621964
Potential improvement: calculate the min/max event counts and
19631965
use percent-based graph bars.
19641966
*/
19651967
--- src/timeline.c
+++ src/timeline.c
@@ -1830,11 +1830,29 @@
1830 db_finalize(&q);
1831 style_footer();
1832 }
1833
1834
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1835
 
1836 /*
1837 ** Implements the "byyear" and "bymonth" reports for /stats_report.
1838 ** If includeMonth is true then it generates the "bymonth" report,
1839 ** else the "byyear" report. If zUserName is not NULL and not empty
1840 ** then the report is restricted to events created by the named user
@@ -1935,30 +1953,14 @@
1935 @ <td>
1936 @ <div class='statistics-report-graph-line'
1937 @ style='height:16px;width:%d(nSize)px;'>
1938 @ </div></td>
1939 @</tr>
1940 if(!includeMonth){
1941 Blob sqlWeek = empty_blob;
1942 Stmt stWeek = empty_Stmt;
1943 db_prepare(&stWeek,
1944 "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
1945 "count(*) AS n, "
1946 "substr(date(mtime),1,4) AS ym "
1947 "FROM event "
1948 "WHERE ym=%Q AND mtime < current_timestamp "
1949 "GROUP BY wk ORDER BY wk",
1950 zTimeframe);
1951 @ <tr><td colspan='2' valign='right'>Week #:</td>
1952 @ <td class='statistics-report-week-of-year-list'>
1953 while( SQLITE_ROW == db_step(&stWeek) ){
1954 zTimeframe = db_column_text(&stWeek,0);
1955 @ %s(zTimeframe)
1956 }
1957 @ </td></tr>
1958 db_finalize(&stWeek);
1959 }
1960
1961 /*
1962 Potential improvement: calculate the min/max event counts and
1963 use percent-based graph bars.
1964 */
1965
--- src/timeline.c
+++ src/timeline.c
@@ -1830,11 +1830,29 @@
1830 db_finalize(&q);
1831 style_footer();
1832 }
1833
1834
1835 static void stats_report_output_week_links( char const * zTimeframe){
1836 Blob sqlWeek = empty_blob;
1837 Stmt stWeek = empty_Stmt;
1838 db_prepare(&stWeek,
1839 "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
1840 "count(*) AS n, "
1841 "substr(date(mtime),1,%d) AS ym "
1842 "FROM event "
1843 "WHERE ym=%Q AND mtime < current_timestamp "
1844 "GROUP BY wk ORDER BY wk",
1845 strlen(zTimeframe),
1846 zTimeframe);
1847 while( SQLITE_ROW == db_step(&stWeek) ){
1848 zTimeframe = db_column_text(&stWeek,0);
1849 @ %s(zTimeframe)
1850 }
1851 db_finalize(&stWeek);
1852
1853 }
1854 /*
1855 ** Implements the "byyear" and "bymonth" reports for /stats_report.
1856 ** If includeMonth is true then it generates the "bymonth" report,
1857 ** else the "byyear" report. If zUserName is not NULL and not empty
1858 ** then the report is restricted to events created by the named user
@@ -1935,30 +1953,14 @@
1953 @ <td>
1954 @ <div class='statistics-report-graph-line'
1955 @ style='height:16px;width:%d(nSize)px;'>
1956 @ </div></td>
1957 @</tr>
1958 @ <tr><td colspan='2' class='statistics-report-week-number-label'>Week #:</td>
1959 @ <td class='statistics-report-week-of-year-list'>
1960 stats_report_output_week_links(zTimeframe);
1961 @ </td></tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1962
1963 /*
1964 Potential improvement: calculate the min/max event counts and
1965 use percent-based graph bars.
1966 */
1967

Keyboard Shortcuts

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