Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch reports-by-type Excluding Merge-Ins
This is equivalent to a diff from e3a2d8f3 to 68e3e0a5
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-03
| ||
14:59 | Revert [b7625d8d8c], instead make sure the correct header file is included for Cygwin. ... (check-in: 19b2b240 user: jan.nijtmans 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) | |
21:28 | Initial draft of type event type argument for /reports. Seems to work but is missing labels and link integration (i.e. can only be used by explicitly passing y=TYPE for the time being). ... (check-in: 331a8b71 user: stephan tags: reports-by-type) | |
11:33 | Fix typos in the server.wiki document. ... (check-in: e3a2d8f3 user: drh tags: trunk) | |
03:26 | Upgrade the included Jim Tcl to 0.74. ... (check-in: 753f4d9a user: mistachkin tags: trunk) | |
Changes to src/timeline.c.
︙ | ︙ | |||
1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 | const char *zUuid = db_column_text(&q, 0); @ <li> @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&d=%S(zUuid)">%S(zUuid)</a> } db_finalize(&q); style_footer(); } /* ** Helper for stats_report_by_month_year(), which generates a list of ** week numbers. zTimeframe should be either a timeframe in the form YYYY ** or YYYY-MM. */ static void stats_report_output_week_links(const char * zTimeframe){ Stmt stWeek = empty_Stmt; char yearPart[5] = {0,0,0,0,0}; memcpy(yearPart, zTimeframe, 4); db_prepare(&stWeek, "SELECT DISTINCT strftime('%%W',mtime) AS wk, " "count(*) AS n, " "substr(date(mtime),1,%d) AS ym " | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 1848 1849 1850 1851 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 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 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 | const char *zUuid = db_column_text(&q, 0); @ <li> @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&d=%S(zUuid)">%S(zUuid)</a> } 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': zRealType = "e"; rc = *zRealType; break; case 'g': case 'G': zRealType = "g"; rc = *zRealType; break; case 't': case 'T': zRealType = "t"; rc = *zRealType; break; case 'w': case 'W': zRealType = "w"; rc = *zRealType; 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"); } return rc; } /* ** Helper for stats_report_by_month_year(), which generates a list of ** week numbers. zTimeframe should be either a timeframe in the form YYYY ** or YYYY-MM. */ static void stats_report_output_week_links(const char * zTimeframe){ Stmt stWeek = empty_Stmt; char yearPart[5] = {0,0,0,0,0}; memcpy(yearPart, zTimeframe, 4); db_prepare(&stWeek, "SELECT DISTINCT strftime('%%W',mtime) AS wk, " "count(*) AS n, " "substr(date(mtime),1,%d) AS ym " "FROM v_reports " "WHERE ym=%Q AND mtime < current_timestamp " "GROUP BY wk ORDER BY wk", strlen(zTimeframe), zTimeframe); while( SQLITE_ROW == db_step(&stWeek) ){ const char * zWeek = db_column_text(&stWeek,0); const int nCount = db_column_int(&stWeek,1); |
︙ | ︙ | |||
1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 | char showYearTotal = 0; /* Flag telling us when to show the per-year event totals */ Blob header = empty_blob; /* Page header text */ int nMaxEvents = 1; /* for calculating length of graph bars. */ int iterations = 0; /* number of weeks/months we iterate over */ blob_appendf(&header, "Timeline Events by year%s", (includeMonth ? "/month" : "")); blob_appendf(&sql, "SELECT substr(date(mtime),1,%d) AS timeframe, " "count(*) AS eventCount " | > | | 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 | char showYearTotal = 0; /* Flag telling us when to show the per-year event totals */ Blob header = empty_blob; /* Page header text */ int nMaxEvents = 1; /* for calculating length of graph bars. */ int iterations = 0; /* number of weeks/months we iterate over */ stats_report_init_view(); blob_appendf(&header, "Timeline Events by year%s", (includeMonth ? "/month" : "")); blob_appendf(&sql, "SELECT substr(date(mtime),1,%d) AS timeframe, " "count(*) AS eventCount " "FROM v_reports ", includeMonth ? 7 : 4); if(zUserName&&*zUserName){ blob_appendf(&sql, " WHERE user=%Q ", zUserName); blob_appendf(&header," for user %q", zUserName); } blob_append(&sql, " GROUP BY timeframe" |
︙ | ︙ | |||
2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 | int nRowNumber = 0; /* current TR number */ int nEventTotal = 0; /* Total event count */ int rowClass = 0; /* counter for alternating row colors */ Blob sql = empty_blob; /* SQL */ int nMaxEvents = 1; /* max number of events for all rows. */ blob_append(&sql, "SELECT user, " "COUNT(*) AS eventCount " | > | | 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 | int nRowNumber = 0; /* current TR number */ int nEventTotal = 0; /* Total event count */ int rowClass = 0; /* counter for alternating row colors */ Blob sql = empty_blob; /* SQL */ int nMaxEvents = 1; /* max number of events for all rows. */ stats_report_init_view(); blob_append(&sql, "SELECT user, " "COUNT(*) AS eventCount " "FROM v_reports " "GROUP BY user ORDER BY eventCount DESC", -1); db_prepare(&query, blob_str(&sql)); blob_reset(&sql); @ <h1>Timeline Events by User</h1> @ <table class='statistics-report-table-events' border='0' @ cellpadding='2' cellspacing='0' id='statsTable'> |
︙ | ︙ | |||
2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 | Stmt qYears = empty_Stmt; char * zDefaultYear = NULL; Blob sql = empty_blob; int nMaxEvents = 1; /* max number of events for all rows. */ int iterations = 0; /* # of active time periods. */ cgi_printf("Select year: "); blob_append(&sql, "SELECT DISTINCT substr(date(mtime),1,4) AS y " | > | | 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 | Stmt qYears = empty_Stmt; char * zDefaultYear = NULL; Blob sql = empty_blob; int nMaxEvents = 1; /* max number of events for all rows. */ int iterations = 0; /* # of active time periods. */ stats_report_init_view(); cgi_printf("Select year: "); blob_append(&sql, "SELECT DISTINCT substr(date(mtime),1,4) AS y " "FROM v_reports WHERE 1 ", -1); if(zUserName&&*zUserName){ blob_appendf(&sql,"AND user=%Q ", zUserName); } blob_append(&sql,"GROUP BY y ORDER BY y", -1); db_prepare(&qYears, blob_str(&sql)); blob_reset(&sql); while( SQLITE_ROW == db_step(&qYears) ){ |
︙ | ︙ | |||
2157 2158 2159 2160 2161 2162 2163 | 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 " | | | 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 | 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); } |
︙ | ︙ |