Fossil SCM

Fixed the table we search for the byweek report. Replaced 'y' param with 'type' because 'y' is already uses for YYYY (year).

stephan 2013-10-02 21:39 UTC reports-by-type
Commit 68e3e0a5dcc5f4aba504c074f19fd4329042e6d5
1 file changed +10 -10
+10 -10
--- src/timeline.c
+++ src/timeline.c
@@ -1854,14 +1854,15 @@
18541854
}
18551855
18561856
/*
18571857
** Creates a TEMP VIEW named v_reports which is a wrapper around the
18581858
** 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
18631864
** invalid/unknown filter values). That 'y' filter is the one used for
18641865
** the event list. Note that a filter of "*" or "all" is equivalent to
18651866
** querying against the full event table. The view, however, adds an
18661867
** abstraction level to simplify the implementation code for the
18671868
** various /reports pages.
@@ -1869,14 +1870,14 @@
18691870
** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of
18701871
** filter it applies, or '*' if no filter is applied (i.e. if "all" is
18711872
** used).
18721873
*/
18731874
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 ){
18781879
case 'c':
18791880
case 'C':
18801881
zRealType = "ci";
18811882
rc = *zRealType;
18821883
break;
@@ -1904,11 +1905,10 @@
19041905
rc = '*';
19051906
break;
19061907
}
19071908
assert(0 != rc);
19081909
if(zRealType){
1909
- assert(*zRealType);
19101910
db_multi_exec("CREATE TEMP VIEW v_reports AS "
19111911
"SELECT * FROM event WHERE type GLOB %Q",
19121912
zRealType);
19131913
}else{
19141914
db_multi_exec("CREATE TEMP VIEW v_reports AS "
@@ -2227,11 +2227,11 @@
22272227
blob_appendf(&header, "Timeline events for the calendar weeks "
22282228
"of %h", zYear);
22292229
blob_appendf(&sql,
22302230
"SELECT DISTINCT strftime('%%%%W',mtime) AS wk, "
22312231
"count(*) AS n "
2232
- "FROM event "
2232
+ "FROM v_reports "
22332233
"WHERE %Q=substr(date(mtime),1,4) "
22342234
"AND mtime < current_timestamp ",
22352235
zYear);
22362236
if(zUserName&&*zUserName){
22372237
blob_appendf(&sql, " AND user=%Q ", zUserName);
22382238
--- 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

Keyboard Shortcuts

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