Fossil SCM
Started work on adding by-calendar-week info to /stats_report. Incomplete but it's bed time.
Commit
cced11153bfe0875f6fb4a9b2bdf0d7900c1643c
Parent
3a4f9ba6527671a…
1 file changed
+29
-7
+29
-7
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1906,17 +1906,19 @@ | ||
| 1906 | 1906 | memcpy(zPrevYear,zTimeframe,4); |
| 1907 | 1907 | rowClass = ++nRowNumber % 2; |
| 1908 | 1908 | @ <tr class='row%d(rowClass)'> |
| 1909 | 1909 | @ <th colspan='3' class='statistics-report-row-year'>%s(zPrevYear)</th> |
| 1910 | 1910 | @ </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> | |
| 1918 | 1920 | if(includeMonth){ |
| 1919 | 1921 | cgi_printf("<a href='%s/timeline?" |
| 1920 | 1922 | "ym=%t&n=%d", |
| 1921 | 1923 | g.zTop, zTimeframe, nCount ); |
| 1922 | 1924 | /* Reminder: n=nCount is not actually correct for bymonth unless |
| @@ -1933,10 +1935,30 @@ | ||
| 1933 | 1935 | @ <td> |
| 1934 | 1936 | @ <div class='statistics-report-graph-line' |
| 1935 | 1937 | @ style='height:16px;width:%d(nSize)px;'> |
| 1936 | 1938 | @ </div></td> |
| 1937 | 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 | + } | |
| 1938 | 1960 | |
| 1939 | 1961 | /* |
| 1940 | 1962 | Potential improvement: calculate the min/max event counts and |
| 1941 | 1963 | use percent-based graph bars. |
| 1942 | 1964 | */ |
| 1943 | 1965 |
| --- 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 |