Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch stats-report-weekly Excluding Merge-Ins
This is equivalent to a diff from 3a4f9ba6 to 38e386a6
2013-07-17
| ||
12:56 | Merge the weekly status reporting enhancements into trunk. ... (check-in: 5d74ce03 user: drh tags: trunk) | |
12:02 | Merge the updated side-by-side diff logic into trunk. ... (check-in: d70ea7ef user: drh tags: trunk) | |
09:34 | Added user flag (if available) to the byyear report's year list links. ... (Closed-Leaf check-in: 38e386a6 user: stephan tags: stats-report-weekly) | |
09:23 | A th1 runtime command which returns the current value of fossil_timer_stop(g.json.timerId). Part of an old ML thread discussion. Probably not needed but maybe interesting. ... (Closed-Leaf check-in: 904a35d9 user: stephan tags: th1-runtime-cmd) | |
2013-07-16
| ||
21:58 | Added n=### to /timeline links from /stats_report byweek view. Added a missing else in /timeline?yw=... which caused too many search clauses and too much header text. ... (check-in: 4f598038 user: stephan tags: stats-report-weekly) | |
04:29 | Create new branch named "ssh-transport-changes" ... (check-in: ddc9601b user: amb tags: ssh-transport-changes) | |
2013-07-15
| ||
22:23 | Started work on adding by-calendar-week info to /stats_report. Incomplete but it's bed time. ... (check-in: cced1115 user: stephan tags: stats-report-weekly) | |
2013-07-14
| ||
22:25 | Merge with trunk. ... (check-in: 3c777c4b user: isaac.jurado tags: git-better-import) | |
14:56 | Rebase. Use -4 as INTEGRATE tag, not -3 ... (check-in: 967ef5f7 user: jan.nijtmans tags: merge-integrate) | |
08:46 | added missing word "to" ... (check-in: 3a4f9ba6 user: stephan tags: trunk) | |
2013-07-12
| ||
11:31 | Any vmerge.id < -2 should be handled as a MERGED_WITH by default, not as BACKOUT (even though trunk fossil cannot produce that yet). ... (check-in: 88e60e8f user: jan.nijtmans tags: trunk) | |
Changes to src/style.c.
︙ | ︙ | |||
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | { ".statistics-report-table-events td", "", @ padding: 0.1em 1em 0.1em 1em; }, { ".statistics-report-row-year", "", @ text-align: left; }, { "tr.row0", "even table row color", @ /* use default */ }, { "tr.row1", "odd table row color", | > > > > > > > > > > > > > | 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | { ".statistics-report-table-events td", "", @ padding: 0.1em 1em 0.1em 1em; }, { ".statistics-report-row-year", "", @ text-align: left; }, { ".statistics-report-graph-line", "for the /stats_report views", @ background-color: #446979; }, { ".statistics-report-week-number-label", "for the /stats_report views", @ text-align: right; @ font-size: 0.8em; }, { ".statistics-report-week-of-year-list", "for the /stats_report views", @ font-size: 0.8em; }, { "tr.row0", "even table row color", @ /* use default */ }, { "tr.row1", "odd table row color", |
︙ | ︙ |
Changes to src/timeline.c.
︙ | ︙ | |||
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 | const char *zBefore = P("b"); /* Events before this time */ const char *zCirca = P("c"); /* Events near this time */ const char *zTagName = P("t"); /* Show events with this tag */ const char *zBrName = P("r"); /* Show events related to this tag */ const char *zSearch = P("s"); /* Search string */ const char *zUses = P("uf"); /* Only show checkins hold this file */ const char *zYearMonth = P("ym"); /* Show checkins for the given YYYY-MM */ int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ int renameOnly = P("namechng")!=0; /* Show only checkins that rename files */ int tagid; /* Tag ID */ int tmFlags; /* Timeline flags */ const char *zThisTag = 0; /* Suppress links to this tag */ const char *zThisUser = 0; /* Suppress links to this user */ HQuery url; /* URL for various branch links */ | > | 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | const char *zBefore = P("b"); /* Events before this time */ const char *zCirca = P("c"); /* Events near this time */ const char *zTagName = P("t"); /* Show events with this tag */ const char *zBrName = P("r"); /* Show events related to this tag */ const char *zSearch = P("s"); /* Search string */ const char *zUses = P("uf"); /* Only show checkins hold this file */ const char *zYearMonth = P("ym"); /* Show checkins for the given YYYY-MM */ const char *zYearWeek = P("yw"); /* Show checkins for the given YYYY-WW (weak-of-year) */ int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ int renameOnly = P("namechng")!=0; /* Show only checkins that rename files */ int tagid; /* Tag ID */ int tmFlags; /* Timeline flags */ const char *zThisTag = 0; /* Suppress links to this tag */ const char *zThisUser = 0; /* Suppress links to this user */ HQuery url; /* URL for various branch links */ |
︙ | ︙ | |||
1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | if( renameOnly ){ blob_appendf(&sql, " AND event.objid IN rnfile "); } if( zYearMonth ){ blob_appendf(&sql, " AND %Q=strftime('%%Y-%%m',event.mtime) ", zYearMonth); } if( tagid>0 ){ blob_appendf(&sql, "AND (EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", tagid); if( zBrName ){ url_add_parameter(&url, "r", zBrName); | > > > > | 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 | if( renameOnly ){ blob_appendf(&sql, " AND event.objid IN rnfile "); } if( zYearMonth ){ blob_appendf(&sql, " AND %Q=strftime('%%Y-%%m',event.mtime) ", zYearMonth); } else if( zYearWeek ){ blob_appendf(&sql, " AND %Q=strftime('%%Y-%%W',event.mtime) ", zYearWeek); } if( tagid>0 ){ blob_appendf(&sql, "AND (EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)", tagid); if( zBrName ){ url_add_parameter(&url, "r", zBrName); |
︙ | ︙ | |||
1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 | } blob_appendf(&sql, " LIMIT %d", nEntry); db_multi_exec("%s", blob_str(&sql)); n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/"); if( zYearMonth ){ blob_appendf(&desc, "%s events for %h", zEType, zYearMonth); }else if( zAfter==0 && zBefore==0 && zCirca==0 ){ blob_appendf(&desc, "%d most recent %ss", n, zEType); }else{ blob_appendf(&desc, "%d %ss", n, zEType); } if( zUses ){ char *zFilenames = names_of_file(zUses); | > > | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 | } blob_appendf(&sql, " LIMIT %d", nEntry); db_multi_exec("%s", blob_str(&sql)); n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/"); if( zYearMonth ){ blob_appendf(&desc, "%s events for %h", zEType, zYearMonth); }else if( zYearWeek ){ blob_appendf(&desc, "%s events for year/week %h", zEType, zYearWeek); }else if( zAfter==0 && zBefore==0 && zCirca==0 ){ blob_appendf(&desc, "%d most recent %ss", n, zEType); }else{ blob_appendf(&desc, "%d %ss", n, zEType); } if( zUses ){ char *zFilenames = names_of_file(zUses); |
︙ | ︙ | |||
1827 1828 1829 1830 1831 1832 1833 | @ <li> @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&d=%S(zUuid)">%S(zUuid)</a> } db_finalize(&q); style_footer(); } | > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 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 | @ <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(char const * 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 event " "WHERE ym=%Q AND mtime < current_timestamp " "GROUP BY wk ORDER BY wk", strlen(zTimeframe), zTimeframe); while( SQLITE_ROW == db_step(&stWeek) ){ char const * zWeek = db_column_text(&stWeek,0); int const nCount = db_column_int(&stWeek,1); cgi_printf("<a href='%s/timeline?" "yw=%t-%t&n=%d'>%s</a>", g.zTop, yearPart, zWeek, nCount, zWeek); } db_finalize(&stWeek); } /* ** Implements the "byyear" and "bymonth" reports for /stats_report. ** If includeMonth is true then it generates the "bymonth" report, ** else the "byyear" report. If zUserName is not NULL and not empty ** then the report is restricted to events created by the named user ** account. */ static void stats_report_by_month_year(char includeMonth, char includeWeeks, char const * zUserName){ Stmt query = empty_Stmt; int const nPixelsPerEvent = 1; /* for sizing the "graph" part */ int nRowNumber = 0; /* current TR number */ int nEventTotal = 0; /* Total event count */ int rowClass = 0; /* counter for alternating row colors */ |
︙ | ︙ | |||
1904 1905 1906 1907 1908 1909 1910 | } 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> | | | | | | | | > > > > | > > > > > > > > > > | 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 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 | } 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 { cgi_printf("<a href='?view=byweek&y=%s", zTimeframe); if(zUserName && *zUserName){ cgi_printf("&u=%t", zUserName); } cgi_printf("'>%s</a>", zTimeframe); } @ </td><td>%d(nCount)</td> @ <td> @ <div class='statistics-report-graph-line' @ style='height:16px;width:%d(nSize)px;'> @ </div></td> @</tr> if(includeWeeks){ /* This part works fine for months but it terribly slow (4.5s on my PC), so it's only shown for by-year for now. Suggestions/patches for a better/faster layout are welcomed. */ @ <tr class='row%d(rowClass)'> @ <td colspan='2' class='statistics-report-week-number-label'>Week #:</td> @ <td class='statistics-report-week-of-year-list'> stats_report_output_week_links(zTimeframe); @ </td></tr> } /* Potential improvement: calculate the min/max event counts and use percent-based graph bars. */ } |
︙ | ︙ | |||
2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 | */ } @ </tbody></table> db_finalize(&query); output_table_sorting_javascript("statsTable","tnx"); } /* ** WEBPAGE: stats_report ** ** Shows activity reports for the repository. ** ** Query Parameters: ** ** view=REPORT_NAME Valid values: bymonth, byyear, byuser ** user=NAME Restricts statistics to the given user */ void stats_report_page(){ HQuery url; /* URL for various branch links */ char const * zView = P("view"); /* Which view/report to show. */ char const *zUserName = P("user"); url_initialize(&url, "stats_report"); if(zUserName && *zUserName){ url_add_parameter(&url,"user", zUserName); timeline_submenu(&url, "(Remove User Flag)", "view", zView, "user"); } timeline_submenu(&url, "By Year", "view", "byyear", 0); timeline_submenu(&url, "By Month", "view", "bymonth", 0); timeline_submenu(&url, "By User", "view", "byuser", "user"); url_reset(&url); style_header("Activity Reports"); if(0==fossil_strcmp(zView,"byyear")){ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > | 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 | */ } @ </tbody></table> db_finalize(&query); output_table_sorting_javascript("statsTable","tnx"); } /* ** 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_year_weeks(char const * zUserName){ char const * zYear = P("y"); int nYear = zYear ? strlen(zYear) : 0; int i = 0; Stmt qYears = empty_Stmt; char * zDefaultYear = NULL; Blob sql = empty_blob; cgi_printf("Select year: "); blob_append(&sql, "SELECT DISTINCT substr(date(mtime),1,4) AS y " "FROM event 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) ){ char const * zT = db_column_text(&qYears, 0); if( i++ ){ cgi_printf(" "); } cgi_printf("<a href='?view=byweek&y=%s", zT); if(zUserName && *zUserName){ cgi_printf("&user=%t",zUserName); } cgi_printf("'>%s</a>",zT); } db_finalize(&qYears); cgi_printf("<br/>"); if(!zYear || !*zYear){ zDefaultYear = db_text("????", "SELECT strftime('%%Y')"); zYear = zDefaultYear; nYear = 4; } if(4 == nYear){ int const nPixelsPerEvent = 3; /* for sizing the "graph" part */ Stmt stWeek = empty_Stmt; int rowCount = 0; 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); } blob_appendf(&sql, "GROUP BY wk ORDER BY wk DESC"); cgi_printf("<h1>%h</h1>", blob_str(&header)); blob_reset(&header); cgi_printf("<table class='statistics-report-table-events' " "border='0' cellpadding='2' " "cellspacing='0' id='statsTable'>"); cgi_printf("<thead><tr>" "<th>Week</th>" "<th>Events</th>" "<th><!-- relative commits graph --></th>" "</tr></thead>" "<tbody>"); db_prepare(&stWeek, blob_str(&sql)); blob_reset(&sql); while( SQLITE_ROW == db_step(&stWeek) ){ char const * zWeek = db_column_text(&stWeek,0); int const nCount = db_column_int(&stWeek,1); int const graphSize = nPixelsPerEvent * nCount; total += nCount; cgi_printf("<tr class='row%d'>", ++rowCount % 2 ); cgi_printf("<td><a href='%s/timeline?yw=%t-%s&n=%d", g.zTop, zYear, zWeek, nCount); if(zUserName && *zUserName){ cgi_printf("&u=%t",zUserName); } cgi_printf("'>%s</a></td>",zWeek); cgi_printf("<td>%d</td>",nCount); cgi_printf("<td>"); if(nCount){ cgi_printf("<div class='statistics-report-graph-line'" "style='height:16px;width:%dpx;'></div>", graphSize); } cgi_printf("</td></tr>"); } db_finalize(&stWeek); free(zDefaultYear); if(total){ cgi_printf("<tr class='row%d'>", ++rowCount%2); cgi_printf("<td colspan='2'>Total events:</td><td>%d</td>", total); cgi_printf("</tr>"); } cgi_printf("</tbody></table>"); output_table_sorting_javascript("statsTable","tnx"); } } /* ** WEBPAGE: stats_report ** ** Shows activity reports for the repository. ** ** Query Parameters: ** ** view=REPORT_NAME Valid values: bymonth, byyear, byuser ** user=NAME Restricts statistics to the given user */ void stats_report_page(){ HQuery url; /* URL for various branch links */ char const * zView = P("view"); /* Which view/report to show. */ char const *zUserName = P("user"); if(!zUserName) zUserName = P("u"); url_initialize(&url, "stats_report"); if(zUserName && *zUserName){ url_add_parameter(&url,"user", zUserName); timeline_submenu(&url, "(Remove User Flag)", "view", zView, "user"); } timeline_submenu(&url, "By Year", "view", "byyear", 0); timeline_submenu(&url, "By Month", "view", "bymonth", 0); timeline_submenu(&url, "By Week", "view", "byweek", 0); timeline_submenu(&url, "By User", "view", "byuser", "user"); url_reset(&url); style_header("Activity Reports"); if(0==fossil_strcmp(zView,"byyear")){ stats_report_by_month_year(0, 0, zUserName); }else if(0==fossil_strcmp(zView,"bymonth")){ stats_report_by_month_year(1, 0, zUserName); }else if(0==fossil_strcmp(zView,"byweek")){ stats_report_year_weeks(zUserName); }else if(0==fossil_strcmp(zView,"byuser")){ stats_report_by_user(); }else{ @ <h1>Select a report to show:</h1> @ <ul> @ <li><a href='?view=byyear'>Events by year</a></li> @ <li><a href='?view=bymonth'>Events by month</a></li> @ <li><a href='?view=byweek'>Events by calendar week</a></li> @ <li><a href='?view=byuser'>Events by user</a></li> @ </ul> } style_footer(); } |