Fossil SCM

Started work on adding by-calendar-week info to /stats_report. Incomplete but it's bed time.

stephan 2013-07-15 22:23 UTC trunk
Commit cced11153bfe0875f6fb4a9b2bdf0d7900c1643c
1 file changed +29 -7
+29 -7
--- src/timeline.c
+++ src/timeline.c
@@ -1906,17 +1906,19 @@
19061906
memcpy(zPrevYear,zTimeframe,4);
19071907
rowClass = ++nRowNumber % 2;
19081908
@ <tr class='row%d(rowClass)'>
19091909
@ <th colspan='3' class='statistics-report-row-year'>%s(zPrevYear)</th>
19101910
@ </tr>
1911
- }
1912
- }
1913
- rowClass = ++nRowNumber % 2;
1914
- nEventTotal += nCount;
1915
- nEventsPerYear += nCount;
1916
- @<tr class='row%d(rowClass)'>
1917
- @ <td>
1911
+ @ <tr><td colspan='3' class='statistics-report-row-year'>
1912
+ @ </td></tr>
1913
+ }
1914
+ }
1915
+ rowClass = ++nRowNumber % 2;
1916
+ nEventTotal += nCount;
1917
+ nEventsPerYear += nCount;
1918
+ @<tr class='row%d(rowClass)'>
1919
+ @ <td>
19181920
if(includeMonth){
19191921
cgi_printf("<a href='%s/timeline?"
19201922
"ym=%t&n=%d",
19211923
g.zTop, zTimeframe, nCount );
19221924
/* Reminder: n=nCount is not actually correct for bymonth unless
@@ -1933,10 +1935,30 @@
19331935
@ <td>
19341936
@ <div class='statistics-report-graph-line'
19351937
@ style='height:16px;width:%d(nSize)px;'>
19361938
@ </div></td>
19371939
@</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
+ }
19381960
19391961
/*
19401962
Potential improvement: calculate the min/max event counts and
19411963
use percent-based graph bars.
19421964
*/
19431965
--- src/timeline.c
+++ src/timeline.c
@@ -1906,17 +1906,19 @@
1906 memcpy(zPrevYear,zTimeframe,4);
1907 rowClass = ++nRowNumber % 2;
1908 @ <tr class='row%d(rowClass)'>
1909 @ <th colspan='3' class='statistics-report-row-year'>%s(zPrevYear)</th>
1910 @ </tr>
1911 }
1912 }
1913 rowClass = ++nRowNumber % 2;
1914 nEventTotal += nCount;
1915 nEventsPerYear += nCount;
1916 @<tr class='row%d(rowClass)'>
1917 @ <td>
 
 
1918 if(includeMonth){
1919 cgi_printf("<a href='%s/timeline?"
1920 "ym=%t&n=%d",
1921 g.zTop, zTimeframe, nCount );
1922 /* Reminder: n=nCount is not actually correct for bymonth unless
@@ -1933,10 +1935,30 @@
1933 @ <td>
1934 @ <div class='statistics-report-graph-line'
1935 @ style='height:16px;width:%d(nSize)px;'>
1936 @ </div></td>
1937 @</tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1938
1939 /*
1940 Potential improvement: calculate the min/max event counts and
1941 use percent-based graph bars.
1942 */
1943
--- src/timeline.c
+++ src/timeline.c
@@ -1906,17 +1906,19 @@
1906 memcpy(zPrevYear,zTimeframe,4);
1907 rowClass = ++nRowNumber % 2;
1908 @ <tr class='row%d(rowClass)'>
1909 @ <th colspan='3' class='statistics-report-row-year'>%s(zPrevYear)</th>
1910 @ </tr>
1911 @ <tr><td colspan='3' class='statistics-report-row-year'>
1912 @ </td></tr>
1913 }
1914 }
1915 rowClass = ++nRowNumber % 2;
1916 nEventTotal += nCount;
1917 nEventsPerYear += nCount;
1918 @<tr class='row%d(rowClass)'>
1919 @ <td>
1920 if(includeMonth){
1921 cgi_printf("<a href='%s/timeline?"
1922 "ym=%t&n=%d",
1923 g.zTop, zTimeframe, nCount );
1924 /* Reminder: n=nCount is not actually correct for bymonth unless
@@ -1933,10 +1935,30 @@
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

Keyboard Shortcuts

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