Fossil SCM
Fixed the table we search for the byweek report. Replaced 'y' param with 'type' because 'y' is already uses for YYYY (year).
Commit
68e3e0a5dcc5f4aba504c074f19fd4329042e6d5
Parent
4c21f20cf89695d…
1 file changed
+10
-10
+10
-10
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1854,14 +1854,15 @@ | ||
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | /* |
| 1857 | 1857 | ** Creates a TEMP VIEW named v_reports which is a wrapper around the |
| 1858 | 1858 | ** EVENT table filtered on event.type. It looks for the request |
| 1859 | -** parameter 'y' (for consistency with /timeline) and expects it to | |
| 1860 | -** contain one of the conventional values from event.type or the value | |
| 1861 | -** "all", which is treated as equivalent to "*". By default (if no | |
| 1862 | -** 'y' is specified), "*" is assumed (that is also the default for | |
| 1859 | +** parameter 'type' (reminder: we "should" use 'y' for consistency | |
| 1860 | +** with /timeline, but /reports uses 'y' for the year) and expects it | |
| 1861 | +** to contain one of the conventional values from event.type or the | |
| 1862 | +** value "all", which is treated as equivalent to "*". By default (if | |
| 1863 | +** no 'y' is specified), "*" is assumed (that is also the default for | |
| 1863 | 1864 | ** invalid/unknown filter values). That 'y' filter is the one used for |
| 1864 | 1865 | ** the event list. Note that a filter of "*" or "all" is equivalent to |
| 1865 | 1866 | ** querying against the full event table. The view, however, adds an |
| 1866 | 1867 | ** abstraction level to simplify the implementation code for the |
| 1867 | 1868 | ** various /reports pages. |
| @@ -1869,14 +1870,14 @@ | ||
| 1869 | 1870 | ** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of |
| 1870 | 1871 | ** filter it applies, or '*' if no filter is applied (i.e. if "all" is |
| 1871 | 1872 | ** used). |
| 1872 | 1873 | */ |
| 1873 | 1874 | static char stats_report_init_view(){ |
| 1874 | - char const * zType = PD("y","*"); /* analog to /timeline?y=... */ | |
| 1875 | - char const * zRealType = NULL; /* normalized form of zType */ | |
| 1876 | - char rc = 0; /* result code */ | |
| 1877 | - switch( (zType && *zType) ? *zType : '*' ){ | |
| 1875 | + char const * zType = PD("type","*"); /* analog to /timeline?y=... */ | |
| 1876 | + char const * zRealType = NULL; /* normalized form of zType */ | |
| 1877 | + char rc = 0; /* result code */ | |
| 1878 | + switch( (zType && *zType) ? *zType : 0 ){ | |
| 1878 | 1879 | case 'c': |
| 1879 | 1880 | case 'C': |
| 1880 | 1881 | zRealType = "ci"; |
| 1881 | 1882 | rc = *zRealType; |
| 1882 | 1883 | break; |
| @@ -1904,11 +1905,10 @@ | ||
| 1904 | 1905 | rc = '*'; |
| 1905 | 1906 | break; |
| 1906 | 1907 | } |
| 1907 | 1908 | assert(0 != rc); |
| 1908 | 1909 | if(zRealType){ |
| 1909 | - assert(*zRealType); | |
| 1910 | 1910 | db_multi_exec("CREATE TEMP VIEW v_reports AS " |
| 1911 | 1911 | "SELECT * FROM event WHERE type GLOB %Q", |
| 1912 | 1912 | zRealType); |
| 1913 | 1913 | }else{ |
| 1914 | 1914 | db_multi_exec("CREATE TEMP VIEW v_reports AS " |
| @@ -2227,11 +2227,11 @@ | ||
| 2227 | 2227 | blob_appendf(&header, "Timeline events for the calendar weeks " |
| 2228 | 2228 | "of %h", zYear); |
| 2229 | 2229 | blob_appendf(&sql, |
| 2230 | 2230 | "SELECT DISTINCT strftime('%%%%W',mtime) AS wk, " |
| 2231 | 2231 | "count(*) AS n " |
| 2232 | - "FROM event " | |
| 2232 | + "FROM v_reports " | |
| 2233 | 2233 | "WHERE %Q=substr(date(mtime),1,4) " |
| 2234 | 2234 | "AND mtime < current_timestamp ", |
| 2235 | 2235 | zYear); |
| 2236 | 2236 | if(zUserName&&*zUserName){ |
| 2237 | 2237 | blob_appendf(&sql, " AND user=%Q ", zUserName); |
| 2238 | 2238 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1854,14 +1854,15 @@ | |
| 1854 | } |
| 1855 | |
| 1856 | /* |
| 1857 | ** Creates a TEMP VIEW named v_reports which is a wrapper around the |
| 1858 | ** EVENT table filtered on event.type. It looks for the request |
| 1859 | ** parameter 'y' (for consistency with /timeline) and expects it to |
| 1860 | ** contain one of the conventional values from event.type or the value |
| 1861 | ** "all", which is treated as equivalent to "*". By default (if no |
| 1862 | ** 'y' is specified), "*" is assumed (that is also the default for |
| 1863 | ** invalid/unknown filter values). That 'y' filter is the one used for |
| 1864 | ** the event list. Note that a filter of "*" or "all" is equivalent to |
| 1865 | ** querying against the full event table. The view, however, adds an |
| 1866 | ** abstraction level to simplify the implementation code for the |
| 1867 | ** various /reports pages. |
| @@ -1869,14 +1870,14 @@ | |
| 1869 | ** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of |
| 1870 | ** filter it applies, or '*' if no filter is applied (i.e. if "all" is |
| 1871 | ** used). |
| 1872 | */ |
| 1873 | static char stats_report_init_view(){ |
| 1874 | char const * zType = PD("y","*"); /* analog to /timeline?y=... */ |
| 1875 | char const * zRealType = NULL; /* normalized form of zType */ |
| 1876 | char rc = 0; /* result code */ |
| 1877 | switch( (zType && *zType) ? *zType : '*' ){ |
| 1878 | case 'c': |
| 1879 | case 'C': |
| 1880 | zRealType = "ci"; |
| 1881 | rc = *zRealType; |
| 1882 | break; |
| @@ -1904,11 +1905,10 @@ | |
| 1904 | rc = '*'; |
| 1905 | break; |
| 1906 | } |
| 1907 | assert(0 != rc); |
| 1908 | if(zRealType){ |
| 1909 | assert(*zRealType); |
| 1910 | db_multi_exec("CREATE TEMP VIEW v_reports AS " |
| 1911 | "SELECT * FROM event WHERE type GLOB %Q", |
| 1912 | zRealType); |
| 1913 | }else{ |
| 1914 | db_multi_exec("CREATE TEMP VIEW v_reports AS " |
| @@ -2227,11 +2227,11 @@ | |
| 2227 | blob_appendf(&header, "Timeline events for the calendar weeks " |
| 2228 | "of %h", zYear); |
| 2229 | blob_appendf(&sql, |
| 2230 | "SELECT DISTINCT strftime('%%%%W',mtime) AS wk, " |
| 2231 | "count(*) AS n " |
| 2232 | "FROM event " |
| 2233 | "WHERE %Q=substr(date(mtime),1,4) " |
| 2234 | "AND mtime < current_timestamp ", |
| 2235 | zYear); |
| 2236 | if(zUserName&&*zUserName){ |
| 2237 | blob_appendf(&sql, " AND user=%Q ", zUserName); |
| 2238 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1854,14 +1854,15 @@ | |
| 1854 | } |
| 1855 | |
| 1856 | /* |
| 1857 | ** Creates a TEMP VIEW named v_reports which is a wrapper around the |
| 1858 | ** EVENT table filtered on event.type. It looks for the request |
| 1859 | ** parameter 'type' (reminder: we "should" use 'y' for consistency |
| 1860 | ** with /timeline, but /reports uses 'y' for the year) and expects it |
| 1861 | ** to contain one of the conventional values from event.type or the |
| 1862 | ** value "all", which is treated as equivalent to "*". By default (if |
| 1863 | ** no 'y' is specified), "*" is assumed (that is also the default for |
| 1864 | ** invalid/unknown filter values). That 'y' filter is the one used for |
| 1865 | ** the event list. Note that a filter of "*" or "all" is equivalent to |
| 1866 | ** querying against the full event table. The view, however, adds an |
| 1867 | ** abstraction level to simplify the implementation code for the |
| 1868 | ** various /reports pages. |
| @@ -1869,14 +1870,14 @@ | |
| 1870 | ** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of |
| 1871 | ** filter it applies, or '*' if no filter is applied (i.e. if "all" is |
| 1872 | ** used). |
| 1873 | */ |
| 1874 | static char stats_report_init_view(){ |
| 1875 | char const * zType = PD("type","*"); /* analog to /timeline?y=... */ |
| 1876 | char const * zRealType = NULL; /* normalized form of zType */ |
| 1877 | char rc = 0; /* result code */ |
| 1878 | switch( (zType && *zType) ? *zType : 0 ){ |
| 1879 | case 'c': |
| 1880 | case 'C': |
| 1881 | zRealType = "ci"; |
| 1882 | rc = *zRealType; |
| 1883 | break; |
| @@ -1904,11 +1905,10 @@ | |
| 1905 | rc = '*'; |
| 1906 | break; |
| 1907 | } |
| 1908 | assert(0 != rc); |
| 1909 | if(zRealType){ |
| 1910 | db_multi_exec("CREATE TEMP VIEW v_reports AS " |
| 1911 | "SELECT * FROM event WHERE type GLOB %Q", |
| 1912 | zRealType); |
| 1913 | }else{ |
| 1914 | db_multi_exec("CREATE TEMP VIEW v_reports AS " |
| @@ -2227,11 +2227,11 @@ | |
| 2227 | blob_appendf(&header, "Timeline events for the calendar weeks " |
| 2228 | "of %h", zYear); |
| 2229 | blob_appendf(&sql, |
| 2230 | "SELECT DISTINCT strftime('%%%%W',mtime) AS wk, " |
| 2231 | "count(*) AS n " |
| 2232 | "FROM v_reports " |
| 2233 | "WHERE %Q=substr(date(mtime),1,4) " |
| 2234 | "AND mtime < current_timestamp ", |
| 2235 | zYear); |
| 2236 | if(zUserName&&*zUserName){ |
| 2237 | blob_appendf(&sql, " AND user=%Q ", zUserName); |
| 2238 |