Fossil

Check-in [68e3e0a5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed the table we search for the byweek report. Replaced 'y' param with 'type' because 'y' is already uses for YYYY (year).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | reports-by-type
Files: files | file ages | folders
SHA1: 68e3e0a5dcc5f4aba504c074f19fd4329042e6d5
User & Date: stephan 2013-10-02 21:39:12
Context
2013-10-08
14:01
integrated reports-by-type. Still missing some UI components, but the feature works if the user adds type=XYZ to the URL args. check-in: 358f8e36 user: stephan tags: trunk
2013-10-02
21:39
Fixed the table we search for the byweek report. Replaced 'y' param with 'type' because 'y' is already uses for YYYY (year). Closed-Leaf check-in: 68e3e0a5 user: stephan tags: reports-by-type
21:32
made the docs match the code. check-in: 4c21f20c user: stephan tags: reports-by-type
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/timeline.c.

1852
1853
1854
1855
1856
1857
1858
1859

1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
....
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
....
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
  db_finalize(&q);
  style_footer();
}

/*
** Creates a TEMP VIEW named v_reports which is a wrapper around the
** EVENT table filtered on event.type. It looks for the request
** parameter 'y' (for consistency with /timeline) and expects it to

** contain one of the conventional values from event.type or the value
** "all", which is treated as equivalent to "*".  By default (if no
** 'y' is specified), "*" is assumed (that is also the default for
** invalid/unknown filter values). That 'y' filter is the one used for
** the event list. Note that a filter of "*" or "all" is equivalent to
** querying against the full event table. The view, however, adds an
** abstraction level to simplify the implementation code for the
** various /reports pages.
**
** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of
** filter it applies, or '*' if no filter is applied (i.e. if "all" is
** used).
*/
static char stats_report_init_view(){
  char const * zType = PD("y","*");  /* analog to /timeline?y=... */
  char const * zRealType = NULL;     /* normalized form of zType */
  char rc = 0;                       /* result code */
  switch( (zType && *zType) ? *zType : '*' ){
    case 'c':
    case 'C':
      zRealType = "ci";
      rc = *zRealType;
      break;
    case 'e':
    case 'E':
................................................................................
      break;
    default:
      rc = '*';
      break;
  }
  assert(0 != rc);
  if(zRealType){
    assert(*zRealType);
    db_multi_exec("CREATE TEMP VIEW v_reports AS "
                  "SELECT * FROM event WHERE type GLOB %Q",
                  zRealType);
  }else{
    db_multi_exec("CREATE TEMP VIEW v_reports AS "
                  "SELECT * FROM event");
  }
................................................................................
    int total = 0;
    Blob header = empty_blob;
    blob_appendf(&header, "Timeline events for the calendar weeks "
                 "of %h", zYear);
    blob_appendf(&sql,
                 "SELECT DISTINCT strftime('%%%%W',mtime) AS wk, "
                 "count(*) AS n "
                 "FROM event "
                 "WHERE %Q=substr(date(mtime),1,4) "
                 "AND mtime < current_timestamp ",
                 zYear);
    if(zUserName&&*zUserName){
      blob_appendf(&sql, " AND user=%Q ", zUserName);
      blob_appendf(&header," for user %h", zUserName);
    }







|
>
|
|
|











|
|
|
|







 







<







 







|







1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
....
1903
1904
1905
1906
1907
1908
1909

1910
1911
1912
1913
1914
1915
1916
....
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
  db_finalize(&q);
  style_footer();
}

/*
** Creates a TEMP VIEW named v_reports which is a wrapper around the
** EVENT table filtered on event.type. It looks for the request
** parameter 'type' (reminder: we "should" use 'y' for consistency
** with /timeline, but /reports uses 'y' for the year) and expects it
** to contain one of the conventional values from event.type or the
** value "all", which is treated as equivalent to "*".  By default (if
** no 'y' is specified), "*" is assumed (that is also the default for
** invalid/unknown filter values). That 'y' filter is the one used for
** the event list. Note that a filter of "*" or "all" is equivalent to
** querying against the full event table. The view, however, adds an
** abstraction level to simplify the implementation code for the
** various /reports pages.
**
** Returns one of: 'c', 'w', 'g', 't', 'e', representing the type of
** filter it applies, or '*' if no filter is applied (i.e. if "all" is
** used).
*/
static char stats_report_init_view(){
  char const * zType = PD("type","*");  /* analog to /timeline?y=... */
  char const * zRealType = NULL;        /* normalized form of zType */
  char rc = 0;                          /* result code */
  switch( (zType && *zType) ? *zType : 0 ){
    case 'c':
    case 'C':
      zRealType = "ci";
      rc = *zRealType;
      break;
    case 'e':
    case 'E':
................................................................................
      break;
    default:
      rc = '*';
      break;
  }
  assert(0 != rc);
  if(zRealType){

    db_multi_exec("CREATE TEMP VIEW v_reports AS "
                  "SELECT * FROM event WHERE type GLOB %Q",
                  zRealType);
  }else{
    db_multi_exec("CREATE TEMP VIEW v_reports AS "
                  "SELECT * FROM event");
  }
................................................................................
    int total = 0;
    Blob header = empty_blob;
    blob_appendf(&header, "Timeline events for the calendar weeks "
                 "of %h", zYear);
    blob_appendf(&sql,
                 "SELECT DISTINCT strftime('%%%%W',mtime) AS wk, "
                 "count(*) AS n "
                 "FROM v_reports "
                 "WHERE %Q=substr(date(mtime),1,4) "
                 "AND mtime < current_timestamp ",
                 zYear);
    if(zUserName&&*zUserName){
      blob_appendf(&sql, " AND user=%Q ", zUserName);
      blob_appendf(&header," for user %h", zUserName);
    }