Fossil

Check-in [cced11153b]
Login

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

Overview
Comment:Started work on adding by-calendar-week info to /stats_report. Incomplete but it's bed time.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | stats-report-weekly
Files: files | file ages | folders
SHA1: cced11153bfe0875f6fb4a9b2bdf0d7900c1643c
User & Date: stephan 2013-07-15 22:23:42.561
Context
2013-07-15
22:41
More work on the by-week report, but it is (A) way too slow for the by year/month view (4.5 sec on my machine) and (B) bed time again. ... (check-in: 37c4fb2249 user: stephan tags: stats-report-weekly)
22:23
Started work on adding by-calendar-week info to /stats_report. Incomplete but it's bed time. ... (check-in: cced11153b user: stephan tags: stats-report-weekly)
2013-07-14
08:46
added missing word "to" ... (check-in: 3a4f9ba652 user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/timeline.c.
1904
1905
1906
1907
1908
1909
1910


1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937




















1938
1939
1940
1941
1942
1943
1944
        }
        nEventsPerYear = 0;
        memcpy(zPrevYear,zTimeframe,4);
        rowClass = ++nRowNumber % 2;
        @ <tr class='row%d(rowClass)'>
        @ <th colspan='3' class='statistics-report-row-year'>%s(zPrevYear)</th>
        @ </tr>


      }
    }
    rowClass = ++nRowNumber % 2;
    nEventTotal += nCount;
    nEventsPerYear += nCount;
    @<tr class='row%d(rowClass)'>
    @ <td>
    if(includeMonth){
      cgi_printf("<a href='%s/timeline?"
                 "ym=%t&n=%d",
                 g.zTop, zTimeframe, nCount );
      /* Reminder: n=nCount is not actually correct for bymonth unless
         that was the only user who caused events.
      */
      if( zUserName && *zUserName ){
        cgi_printf("&u=%t", zUserName);
      }
      cgi_printf("' target='_new'>%s</a>",zTimeframe);
    }else {
      @ %s(zTimeframe)
    }
    @ </td><td>%d(nCount)</td>
    @ <td>
    @ <div class='statistics-report-graph-line'
    @  style='height:16px;width:%d(nSize)px;'>
    @ </div></td>
    @</tr>





















    /*
      Potential improvement: calculate the min/max event counts and
      use percent-based graph bars.
    */
  }








>
>
|
|
|
|
|
|
|




















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
        }
        nEventsPerYear = 0;
        memcpy(zPrevYear,zTimeframe,4);
        rowClass = ++nRowNumber % 2;
        @ <tr class='row%d(rowClass)'>
        @ <th colspan='3' class='statistics-report-row-year'>%s(zPrevYear)</th>
        @ </tr>
        @ <tr><td colspan='3' class='statistics-report-row-year'>
        @ </td></tr>
     }
   }
   rowClass = ++nRowNumber % 2;
   nEventTotal += nCount;
   nEventsPerYear += nCount;
   @<tr class='row%d(rowClass)'>
   @ <td>
    if(includeMonth){
      cgi_printf("<a href='%s/timeline?"
                 "ym=%t&n=%d",
                 g.zTop, zTimeframe, nCount );
      /* Reminder: n=nCount is not actually correct for bymonth unless
         that was the only user who caused events.
      */
      if( zUserName && *zUserName ){
        cgi_printf("&u=%t", zUserName);
      }
      cgi_printf("' target='_new'>%s</a>",zTimeframe);
    }else {
      @ %s(zTimeframe)
    }
    @ </td><td>%d(nCount)</td>
    @ <td>
    @ <div class='statistics-report-graph-line'
    @  style='height:16px;width:%d(nSize)px;'>
    @ </div></td>
    @</tr>
    if(!includeMonth){
      Blob sqlWeek = empty_blob;
      Stmt stWeek = empty_Stmt;
      db_prepare(&stWeek,
                 "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
                 "count(*) AS n, "
                 "substr(date(mtime),1,4) AS ym "
                 "FROM event "
                 "WHERE ym=%Q AND mtime < current_timestamp "
                 "GROUP BY wk ORDER BY wk",
                 zTimeframe);
      @ <tr><td colspan='2' valign='right'>Week #:</td>
      @ <td class='statistics-report-week-of-year-list'>
      while( SQLITE_ROW == db_step(&stWeek) ){
        zTimeframe = db_column_text(&stWeek,0);
        @ %s(zTimeframe)
      }
      @ </td></tr>
      db_finalize(&stWeek);
    }

    /*
      Potential improvement: calculate the min/max event counts and
      use percent-based graph bars.
    */
  }