Fossil

Check-in [2889bfb227]
Login

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

Overview
Comment:Minor cosmetic tweaks to /activity page. Now counts all events, not just commits.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2889bfb227e6da1631eede4625c29e75f8f3d4ca
User & Date: stephan 2013-05-04 21:47:00.386
Original Comment: Minor cosmetic tweaks to /activity page. No counts all events, not just commits.
Context
2013-05-05
12:56
Replaced /activity with /stats_report. Supported by-month and by-year reports. Use user=NAME to limit report to that user (no UI yet for user selection). ... (check-in: 0de6582660 user: stephan tags: trunk)
2013-05-04
21:47
Minor cosmetic tweaks to /activity page. Now counts all events, not just commits. ... (check-in: 2889bfb227 user: stephan tags: trunk)
21:36
Added a missing db_finalize(). Replaced a TODO text with the corresponding code. Changed timeline page header when the ym=YYYY-MM param is set. ... (check-in: d16c09f8c1 user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/timeline.c.
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
1876
1877
1878
1879
/*
** WEBPAGE: activity
**
** Shows an activity report for the repository.
*/
void activity_page(){
  Stmt query = empty_Stmt;
  int const nPixelsPerCommit = 2;
  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;
    char const rowClass = ++nRowNumber % 2;
    int const nTimelineCount =
      db_int(200, "SELECT COUNT(*) FROM event WHERE "
             "substr(date(mtime),1,7)=%Q",
             zMonth);
    nCommitCount += nCount;
    @<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)
  db_finalize(&query);
  style_footer();
}







|


>




<


|



|





|
|
<
<
<
<



|






>
>
>
>

<



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

1876
1877
1878
/*
** WEBPAGE: activity
**
** Shows an activity report for the repository.
*/
void activity_page(){
  Stmt query = empty_Stmt;
  int const nPixelsPerEvent = 1;
  int nRowNumber = 0;
  int nCommitCount = 0;
  int rowClass = 0;
  style_header("Repository Activity");
  db_prepare(&query,
              "SELECT substr(date(mtime),1,7) AS Month, "
              "count(*) AS Commits FROM event "

              "GROUP BY Month "
              "ORDER BY Month DESC", -1);
  @ <h1>Timeline Events by Month</h1>
  @ <table class='activity-table-commits-by-month' border='0' cellpadding='2' cellspacing='0'>
  @ <thead>
  @ <th>Year/Month</th>
  @ <th>Events</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 = nPixelsPerEvent * nCount;
    rowClass = ++nRowNumber % 2;




    nCommitCount += nCount;
    @<tr class='row%d(rowClass)'>
    @ <td>
    @ <a href="%s(g.zTop)/timeline?ym=%s(zMonth)&n=%d(nCount)" 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>
  }
  rowClass = ++nRowNumber % 2;
  @ <tr class='row%d(rowClass)'>
  @   <td colspan='3'>Total events: %d(nCommitCount)</td>
  @ </tr>
  @ </tbody></table>

  db_finalize(&query);
  style_footer();
}