Fossil SCM

Initial support for user=drh in byweek view, but need to add support for carrying it over in the year links. Bed time.

stephan 2013-07-16 21:05 UTC stats-report-weekly
Commit 52dc6c80ec741f9fea7ff636933a350ec4e89bdc
1 file changed +22 -10
+22 -10
--- src/timeline.c
+++ src/timeline.c
@@ -2068,14 +2068,16 @@
20682068
char const * zYear = P("y");
20692069
int nYear = zYear ? strlen(zYear) : 0;
20702070
int i = 0;
20712071
Stmt qYears = empty_Stmt;
20722072
char * zDefaultYear = NULL;
2073
+ char const * zUserName = P("user");
20732074
cgi_printf("Select year: ");
20742075
db_prepare(&qYears,
20752076
"SELECT DISTINCT substr(date(mtime),1,4) AS y "
20762077
"FROM event GROUP BY y ORDER BY y");
2078
+
20772079
while( SQLITE_ROW == db_step(&qYears) ){
20782080
char const * zT = db_column_text(&qYears, 0);
20792081
if( i++ ){
20802082
cgi_printf(" ");
20812083
}
@@ -2091,29 +2093,39 @@
20912093
}
20922094
if(4 == nYear){
20932095
int const nPixelsPerEvent = 3; /* for sizing the "graph" part */
20942096
Stmt stWeek = empty_Stmt;
20952097
int rowCount = 0;
2096
- cgi_printf("<h1>Timeline events for the calendar weeks of %h.</h1>",
2097
- zYear);
2098
+ Blob sql = empty_blob;
2099
+ Blob header = empty_blob;
2100
+ blob_appendf(&header, "Timeline events for the calendar weeks "
2101
+ "of %h", zYear);
2102
+ blob_appendf(&sql,
2103
+ "SELECT DISTINCT strftime('%%%%W',mtime) AS wk, "
2104
+ "count(*) AS n "
2105
+ "FROM event "
2106
+ "WHERE %Q=substr(date(mtime),1,4) "
2107
+ "AND mtime < current_timestamp ",
2108
+ zYear);
2109
+ if(zUserName&&*zUserName){
2110
+ blob_appendf(&sql, " AND user=%Q ", zUserName);
2111
+ blob_appendf(&header," for user %h", zUserName);
2112
+ }
2113
+ blob_appendf(&sql, "GROUP BY wk ORDER BY wk DESC");
2114
+ cgi_printf("<h1>%h</h1>", blob_str(&header));
2115
+ blob_reset(&header);
20982116
cgi_printf("<table class='statistics-report-table-events' "
20992117
"border='0' cellpadding='2' "
21002118
"cellspacing='0' id='statsTable'>");
21012119
cgi_printf("<thead><tr>"
21022120
"<th>Week</th>"
21032121
"<th>Events</th>"
21042122
"<th><!-- relative commits graph --></th>"
21052123
"</tr></thead>"
21062124
"<tbody>");
2107
- db_prepare(&stWeek,
2108
- "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
2109
- "count(*) AS n "
2110
- "FROM event "
2111
- "WHERE %Q=substr(date(mtime),1,4) "
2112
- "AND mtime < current_timestamp "
2113
- "GROUP BY wk ORDER BY wk DESC",
2114
- zYear);
2125
+ db_prepare(&stWeek, blob_str(&sql));
2126
+ blob_reset(&sql);
21152127
while( SQLITE_ROW == db_step(&stWeek) ){
21162128
char const * zWeek = db_column_text(&stWeek,0);
21172129
int nCount = db_column_int(&stWeek,1);
21182130
int const graphSize = nPixelsPerEvent * nCount;
21192131
cgi_printf("<tr class='row%d'>", ++rowCount % 2 );
21202132
--- src/timeline.c
+++ src/timeline.c
@@ -2068,14 +2068,16 @@
2068 char const * zYear = P("y");
2069 int nYear = zYear ? strlen(zYear) : 0;
2070 int i = 0;
2071 Stmt qYears = empty_Stmt;
2072 char * zDefaultYear = NULL;
 
2073 cgi_printf("Select year: ");
2074 db_prepare(&qYears,
2075 "SELECT DISTINCT substr(date(mtime),1,4) AS y "
2076 "FROM event GROUP BY y ORDER BY y");
 
2077 while( SQLITE_ROW == db_step(&qYears) ){
2078 char const * zT = db_column_text(&qYears, 0);
2079 if( i++ ){
2080 cgi_printf(" ");
2081 }
@@ -2091,29 +2093,39 @@
2091 }
2092 if(4 == nYear){
2093 int const nPixelsPerEvent = 3; /* for sizing the "graph" part */
2094 Stmt stWeek = empty_Stmt;
2095 int rowCount = 0;
2096 cgi_printf("<h1>Timeline events for the calendar weeks of %h.</h1>",
2097 zYear);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2098 cgi_printf("<table class='statistics-report-table-events' "
2099 "border='0' cellpadding='2' "
2100 "cellspacing='0' id='statsTable'>");
2101 cgi_printf("<thead><tr>"
2102 "<th>Week</th>"
2103 "<th>Events</th>"
2104 "<th><!-- relative commits graph --></th>"
2105 "</tr></thead>"
2106 "<tbody>");
2107 db_prepare(&stWeek,
2108 "SELECT DISTINCT strftime('%%W',mtime) AS wk, "
2109 "count(*) AS n "
2110 "FROM event "
2111 "WHERE %Q=substr(date(mtime),1,4) "
2112 "AND mtime < current_timestamp "
2113 "GROUP BY wk ORDER BY wk DESC",
2114 zYear);
2115 while( SQLITE_ROW == db_step(&stWeek) ){
2116 char const * zWeek = db_column_text(&stWeek,0);
2117 int nCount = db_column_int(&stWeek,1);
2118 int const graphSize = nPixelsPerEvent * nCount;
2119 cgi_printf("<tr class='row%d'>", ++rowCount % 2 );
2120
--- src/timeline.c
+++ src/timeline.c
@@ -2068,14 +2068,16 @@
2068 char const * zYear = P("y");
2069 int nYear = zYear ? strlen(zYear) : 0;
2070 int i = 0;
2071 Stmt qYears = empty_Stmt;
2072 char * zDefaultYear = NULL;
2073 char const * zUserName = P("user");
2074 cgi_printf("Select year: ");
2075 db_prepare(&qYears,
2076 "SELECT DISTINCT substr(date(mtime),1,4) AS y "
2077 "FROM event GROUP BY y ORDER BY y");
2078
2079 while( SQLITE_ROW == db_step(&qYears) ){
2080 char const * zT = db_column_text(&qYears, 0);
2081 if( i++ ){
2082 cgi_printf(" ");
2083 }
@@ -2091,29 +2093,39 @@
2093 }
2094 if(4 == nYear){
2095 int const nPixelsPerEvent = 3; /* for sizing the "graph" part */
2096 Stmt stWeek = empty_Stmt;
2097 int rowCount = 0;
2098 Blob sql = empty_blob;
2099 Blob header = empty_blob;
2100 blob_appendf(&header, "Timeline events for the calendar weeks "
2101 "of %h", zYear);
2102 blob_appendf(&sql,
2103 "SELECT DISTINCT strftime('%%%%W',mtime) AS wk, "
2104 "count(*) AS n "
2105 "FROM event "
2106 "WHERE %Q=substr(date(mtime),1,4) "
2107 "AND mtime < current_timestamp ",
2108 zYear);
2109 if(zUserName&&*zUserName){
2110 blob_appendf(&sql, " AND user=%Q ", zUserName);
2111 blob_appendf(&header," for user %h", zUserName);
2112 }
2113 blob_appendf(&sql, "GROUP BY wk ORDER BY wk DESC");
2114 cgi_printf("<h1>%h</h1>", blob_str(&header));
2115 blob_reset(&header);
2116 cgi_printf("<table class='statistics-report-table-events' "
2117 "border='0' cellpadding='2' "
2118 "cellspacing='0' id='statsTable'>");
2119 cgi_printf("<thead><tr>"
2120 "<th>Week</th>"
2121 "<th>Events</th>"
2122 "<th><!-- relative commits graph --></th>"
2123 "</tr></thead>"
2124 "<tbody>");
2125 db_prepare(&stWeek, blob_str(&sql));
2126 blob_reset(&sql);
 
 
 
 
 
 
2127 while( SQLITE_ROW == db_step(&stWeek) ){
2128 char const * zWeek = db_column_text(&stWeek,0);
2129 int nCount = db_column_int(&stWeek,1);
2130 int const graphSize = nPixelsPerEvent * nCount;
2131 cgi_printf("<tr class='row%d'>", ++rowCount % 2 );
2132

Keyboard Shortcuts

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