| ︙ | | | ︙ | |
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
includeMonth ? 7 : 4, zUserName);
@ <h1>Timeline Events (%s(stats_report_label_for_type()))
@ by year%s(includeMonth ? "/month" : "")
if( zUserName ){
@ for user %h(zUserName)
}
@ </h1>
@ <table class='statistics-report-table-events' border='0' cellpadding='2'
@ cellspacing='0' id='statsTable'>
@ <thead>
@ <th>%s(zTimeLabel)</th>
@ <th>Events</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </thead><tbody>
/*
Run the query twice. The first time we calculate the maximum
|
>
>
|
>
>
>
|
>
|
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
includeMonth ? 7 : 4, zUserName);
@ <h1>Timeline Events (%s(stats_report_label_for_type()))
@ by year%s(includeMonth ? "/month" : "")
if( zUserName ){
@ for user %h(zUserName)
}
@ </h1>
@ <table border='0' cellpadding='2' cellspacing='0' \
if( !includeMonth ){
@ class='statistics-report-table-events sortable' \
@ data-column-types='tnx' data-init-sort='0'>
style_table_sorter();
}else{
@ class='statistics-report-table-events'>
}
@ <thead>
@ <th>%s(zTimeLabel)</th>
@ <th>Events</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </thead><tbody>
/*
Run the query twice. The first time we calculate the maximum
|
| ︙ | | | ︙ | |
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
if(nEventTotal){
const char *zAvgLabel = includeMonth ? "month" : "year";
int nAvg = iterations ? (nEventTotal/iterations) : 0;
@ <br /><div>Total events: %d(nEventTotal)
@ <br />Average per active %s(zAvgLabel): %d(nAvg)
@ </div>
}
if( !includeMonth ){
output_table_sorting_javascript("statsTable","tnx",-1);
}
}
/*
** Implements the "byuser" view for /reports.
*/
static void stats_report_by_user(){
Stmt query = empty_Stmt;
|
<
<
<
|
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
if(nEventTotal){
const char *zAvgLabel = includeMonth ? "month" : "year";
int nAvg = iterations ? (nEventTotal/iterations) : 0;
@ <br /><div>Total events: %d(nEventTotal)
@ <br />Average per active %s(zAvgLabel): %d(nAvg)
@ </div>
}
}
/*
** Implements the "byuser" view for /reports.
*/
static void stats_report_by_user(){
Stmt query = empty_Stmt;
|
| ︙ | | | ︙ | |
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
" GROUP BY ifnull(euser,user) ORDER BY count(*) DESC;"
);
if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){
@ <center><svg width=700 height=400>
piechart_render(700, 400, PIE_OTHER|PIE_PERCENT);
@ </svg></centre><hr />
}
@ <table class='statistics-report-table-events' border='0'
@ cellpadding='2' cellspacing='0' id='statsTable'>
@ <thead><tr>
@ <th>User</th>
@ <th>Events</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </tr></thead><tbody>
db_prepare(&query,
"SELECT ifnull(euser,user), "
|
>
|
|
|
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
" GROUP BY ifnull(euser,user) ORDER BY count(*) DESC;"
);
if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){
@ <center><svg width=700 height=400>
piechart_render(700, 400, PIE_OTHER|PIE_PERCENT);
@ </svg></centre><hr />
}
style_table_sorter();
@ <table class='statistics-report-table-events sortable' border='0' \
@ cellpadding='2' cellspacing='0' data-column-types='tkx' data-init-sort='2'>
@ <thead><tr>
@ <th>User</th>
@ <th>Events</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </tr></thead><tbody>
db_prepare(&query,
"SELECT ifnull(euser,user), "
|
| ︙ | | | ︙ | |
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
/*
Potential improvement: calculate the min/max event counts and
use percent-based graph bars.
*/
}
@ </tbody></table>
db_finalize(&query);
output_table_sorting_javascript("statsTable","tkx",2);
}
/*
** Implements the "byfile" view for /reports. If zUserName is not NULL then the
** report is restricted to events created by the named user account.
*/
static void stats_report_by_file(const char *zUserName){
|
<
|
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
/*
Potential improvement: calculate the min/max event counts and
use percent-based graph bars.
*/
}
@ </tbody></table>
db_finalize(&query);
}
/*
** Implements the "byfile" view for /reports. If zUserName is not NULL then the
** report is restricted to events created by the named user account.
*/
static void stats_report_by_file(const char *zUserName){
|
| ︙ | | | ︙ | |
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
);
mxEvent = db_int(1, "SELECT max(cnt) FROM statrep");
@ <h1>Check-ins Per File
if( zUserName ){
@ for user %h(zUserName)
}
@ </h1>
@ <table class='statistics-report-table-events' border='0'
@ cellpadding='2' cellspacing='0' id='statsTable'>
@ <thead><tr>
@ <th>File</th>
@ <th>Check-ins</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </tr></thead><tbody>
while( SQLITE_ROW == db_step(&query) ){
const char *zFile = db_column_text(&query, 0);
|
>
|
|
|
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
);
mxEvent = db_int(1, "SELECT max(cnt) FROM statrep");
@ <h1>Check-ins Per File
if( zUserName ){
@ for user %h(zUserName)
}
@ </h1>
style_table_sorter();
@ <table class='statistics-report-table-events sortable' border='0' \
@ cellpadding='2' cellspacing='0' data-column-types='tNx' data-init-sort='2'>
@ <thead><tr>
@ <th>File</th>
@ <th>Check-ins</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </tr></thead><tbody>
while( SQLITE_ROW == db_step(&query) ){
const char *zFile = db_column_text(&query, 0);
|
| ︙ | | | ︙ | |
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
|
@ <div class='statistics-report-graph-line'
@ style='width:%d(sz)%%;'> </div>
@ </td>
@</tr>
}
@ </tbody></table>
db_finalize(&query);
output_table_sorting_javascript("statsTable","tNx",2);
}
/*
** Implements the "byweekday" view for /reports. If zUserName is not NULL then
** the report is restricted to events created by the named user account.
*/
static void stats_report_day_of_week(const char *zUserName){
|
|
|
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
|
@ <div class='statistics-report-graph-line'
@ style='width:%d(sz)%%;'> </div>
@ </td>
@</tr>
}
@ </tbody></table>
db_finalize(&query);
}
/*
** Implements the "byweekday" view for /reports. If zUserName is not NULL then
** the report is restricted to events created by the named user account.
*/
static void stats_report_day_of_week(const char *zUserName){
|
| ︙ | | | ︙ | |
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
|
, zUserName
);
if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){
@ <center><svg width=700 height=400>
piechart_render(700, 400, PIE_OTHER|PIE_PERCENT);
@ </svg></centre><hr />
}
@ <table class='statistics-report-table-events' border='0'
@ cellpadding='2' cellspacing='0' id='statsTable'>
@ <thead><tr>
@ <th>DoW</th>
@ <th>Day</th>
@ <th>Events</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </tr></thead><tbody>
while( SQLITE_ROW == db_step(&query) ){
|
>
|
|
|
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
|
, zUserName
);
if( db_int(0, "SELECT count(*) FROM piechart")>=2 ){
@ <center><svg width=700 height=400>
piechart_render(700, 400, PIE_OTHER|PIE_PERCENT);
@ </svg></centre><hr />
}
style_table_sorter();
@ <table class='statistics-report-table-events sortable' border='0' \
@ cellpadding='2' cellspacing='0' data-column-types='ntnx' data-init-sort='1'>
@ <thead><tr>
@ <th>DoW</th>
@ <th>Day</th>
@ <th>Events</th>
@ <th width='90%%'><!-- relative commits graph --></th>
@ </tr></thead><tbody>
while( SQLITE_ROW == db_step(&query) ){
|
| ︙ | | | ︙ | |
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
|
@ <div class='statistics-report-graph-line'
@ style='width:%d(nSize)%%;'> </div>
@ </td>
@</tr>
}
@ </tbody></table>
db_finalize(&query);
output_table_sorting_javascript("statsTable","ntnx",1);
}
/*
** 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. If zUserName is not NULL then the report is restricted to events
|
<
|
545
546
547
548
549
550
551
552
553
554
555
556
557
558
|
@ <div class='statistics-report-graph-line'
@ style='width:%d(nSize)%%;'> </div>
@ </td>
@</tr>
}
@ </tbody></table>
db_finalize(&query);
}
/*
** 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. If zUserName is not NULL then the report is restricted to events
|
| ︙ | | | ︙ | |
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
|
" GROUP BY wk ORDER BY wk DESC", zYear, zUserName);
@ <h1>Timeline events (%h(stats_report_label_for_type()))
@ for the calendar weeks of %h(zYear)
if( zUserName ){
@ for user %h(zUserName)
}
@ </h1>
cgi_printf("<table class='statistics-report-table-events' "
"border='0' cellpadding='2' width='100%%' "
"cellspacing='0' id='statsTable'>");
cgi_printf("<thead><tr>"
"<th>Week</th>"
"<th>Events</th>"
"<th width='90%%'><!-- relative commits graph --></th>"
"</tr></thead>"
"<tbody>");
while( SQLITE_ROW == db_step(&q) ){
|
>
|
|
|
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
|
" GROUP BY wk ORDER BY wk DESC", zYear, zUserName);
@ <h1>Timeline events (%h(stats_report_label_for_type()))
@ for the calendar weeks of %h(zYear)
if( zUserName ){
@ for user %h(zUserName)
}
@ </h1>
style_table_sorter();
cgi_printf("<table class='statistics-report-table-events sortable' "
"border='0' cellpadding='2' width='100%%' "
"cellspacing='0' data-column-types='tnx' data-init-sort='0'>");
cgi_printf("<thead><tr>"
"<th>Week</th>"
"<th>Events</th>"
"<th width='90%%'><!-- relative commits graph --></th>"
"</tr></thead>"
"<tbody>");
while( SQLITE_ROW == db_step(&q) ){
|
| ︙ | | | ︙ | |
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
|
cgi_printf("</tbody></table>");
if(total){
int nAvg = iterations ? (total/iterations) : 0;
cgi_printf("<br /><div>Total events: %d<br />"
"Average per active week: %d</div>",
total, nAvg);
}
output_table_sorting_javascript("statsTable","tnx",-1);
}
/*
** Generate a report that shows the most recent change for each user.
*/
static void stats_report_last_change(void){
Stmt s;
double rNow;
char *zBaseUrl;
stats_report_init_view();
@ <h1>Event Summary
@ (%s(stats_report_label_for_type())) by User</h1>
@ <table border=1 class='statistics-report-table-events'
@ cellpadding=2 cellspacing=0 id='lastchng'>
@ <thead><tr>
@ <th>User<th>Total Changes<th>Last Change</tr></thead>
@ <tbody>
zBaseUrl = mprintf("%R/timeline?y=%t&u=", PD("type","ci"));
db_prepare(&s,
"SELECT coalesce(euser,user),"
" count(*),"
|
<
>
|
|
|
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
|
cgi_printf("</tbody></table>");
if(total){
int nAvg = iterations ? (total/iterations) : 0;
cgi_printf("<br /><div>Total events: %d<br />"
"Average per active week: %d</div>",
total, nAvg);
}
}
/*
** Generate a report that shows the most recent change for each user.
*/
static void stats_report_last_change(void){
Stmt s;
double rNow;
char *zBaseUrl;
stats_report_init_view();
style_table_sorter();
@ <h1>Event Summary
@ (%s(stats_report_label_for_type())) by User</h1>
@ <table border=1 class='statistics-report-table-events sortable' \
@ cellpadding=2 cellspacing=0 data-column-types='tNK' data-init-sort='3'>
@ <thead><tr>
@ <th>User<th>Total Changes<th>Last Change</tr></thead>
@ <tbody>
zBaseUrl = mprintf("%R/timeline?y=%t&u=", PD("type","ci"));
db_prepare(&s,
"SELECT coalesce(euser,user),"
" count(*),"
|
| ︙ | | | ︙ | |
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
|
@ <td>%d(cnt)
@ <td data-sortkey='%f(rMTime)' style='white-space:nowrap'>%s(zAge?zAge:"")
@ </tr>
fossil_free(zAge);
}
@ </tbody></table>
db_finalize(&s);
output_table_sorting_javascript("lastchng","tNK",3);
}
/* Report types
*/
#define RPT_BYFILE 1
#define RPT_BYMONTH 2
|
<
|
684
685
686
687
688
689
690
691
692
693
694
695
696
697
|
@ <td>%d(cnt)
@ <td data-sortkey='%f(rMTime)' style='white-space:nowrap'>%s(zAge?zAge:"")
@ </tr>
fossil_free(zAge);
}
@ </tbody></table>
db_finalize(&s);
}
/* Report types
*/
#define RPT_BYFILE 1
#define RPT_BYMONTH 2
|
| ︙ | | | ︙ | |