Fossil

Check-in [495bf1ea8d]
Login

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

Overview
Comment:Added initial version of /activity page, intended to show "activity reports." Currently shows commit count by month.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 495bf1ea8d1615c249bd6d4bcb863ceb6e368d80
User & Date: stephan 2013-05-04 20:39:31.087
Context
2013-05-04
20:45
Fixed a C++-ism. Added a note for a potential improvement. ... (check-in: fd74734bf8 user: stephan tags: trunk)
20:39
Added initial version of /activity page, intended to show "activity reports." Currently shows commit count by month. ... (check-in: 495bf1ea8d user: stephan tags: trunk)
19:40
Added ym=YYYY-MM parameter for the /timeline page to restrict the list to the given year and month. This is in preparation for a 'repo activity summary' view/report which includes links back to specific years/months. ... (check-in: c5ea75133a user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/style.c.
610
611
612
613
614
615
616


















617
618
619
620
621
622
623
@
@ /* The label/value pairs on (for example) the ci page */
@ table.label-value th {
@   vertical-align: top;
@   text-align: right;
@   padding: 0.2ex 2ex;
@ }


















;


/* The following table contains bits of default CSS that must
** be included if they are not found in the application-defined
** CSS.
*/







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







610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
@
@ /* The label/value pairs on (for example) the ci page */
@ table.label-value th {
@   vertical-align: top;
@   text-align: right;
@   padding: 0.2ex 2ex;
@ }
@
@ /* .activity-* are for the /activity views */
@ .activity-graph-line {
@   background-color: #446979;
@ }
@ .activity-table-commits-by-month th {
@   padding: 0 1em 0 1em;
@ }
@ .activity-table-commits-by-month td {
@   padding: 0.1em 1em 0.1em 1em;
@ }
@ /* row0 and row1 are for alternating table row colors */
@ tr.row0 {
@  background: #fff;
@ }
@ tr.row1 {
@   background-color: #dadada;
@ }
;


/* The following table contains bits of default CSS that must
** be included if they are not found in the application-defined
** CSS.
*/
Changes to src/timeline.c.
1822
1823
1824
1825
1826
1827
1828















































    const char *zUuid = db_column_text(&q, 0);
    @ <li>
    @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&amp;d=%S(zUuid)">%S(zUuid)</a>
  }
  db_finalize(&q);
  style_footer();
}






















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
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
    const char *zUuid = db_column_text(&q, 0);
    @ <li>
    @ <a href="%s(g.zTop)/timeline?p=%S(zUuid)&amp;d=%S(zUuid)">%S(zUuid)</a>
  }
  db_finalize(&q);
  style_footer();
}

/*
** WEBPAGE: activity
**
** Shows an activity report for the repository.
*/
void activity_page(){
  Stmt query = empty_Stmt;
  int const nPixelsPerCommit = 2;
  int const nTimelineCount = 200;
  int nRowNumber = 0;
  int nCommitCount = 0;
  style_header("Repository Activity");

  db_prepare(&query,
              "SELECT substr(date(mtime),1,7) AS Month, "
              "count(*) AS Commits FROM event "
              "WHERE type='ci' "
              "GROUP BY Month "
              "ORDER BY Month DESC", -1);

  @ <h1>Commits by Month</h1>
  @ <table class='activity-table-commits-by-month' border='0' cellpadding='2' cellspacing='0'>
  @ <thead>
  @ <th>Year/Month</th>
  @ <th>Commits</th>
  @ <th><!-- relative commits graph --></th>
  @ </thead><tbody>
  while( SQLITE_ROW == db_step(&query) ){
    char const * zMonth = db_column_text(&query, 0);
    int const nCount = db_column_int(&query, 1);
    int const nSize = nPixelsPerCommit * nCount;
    nCommitCount += nCount;
    char rowClass = ++nRowNumber % 2;
    @<tr class='row%d(rowClass)'>
    @ <td>
    @ <a href="%s(g.zTop)/timeline?ym=%s(zMonth)&n=%d(nTimelineCount)" target="_new">%s(zMonth)</a>
    @ </td><td>%d(nCount)</td>
    @ <td>
    @ <div class='activity-graph-line' style='height:16px; width:%d(nSize)px;'>
    @ </div></td>
    @</tr>
  }
  @ </tbody></table>
  @ Total commits: %d(nCommitCount)
  style_footer();
}