summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2010-07-06 18:26:08 +0000
committerrandomdan <randomdan@localhost>2010-07-06 18:26:08 +0000
commit328338c9f1e2be3160e58223bef3e0121719d75b (patch)
treee85ea528e17ac959284b75f8e33ab32e7025a96b
parentImplement connection caching and checking (requires ODBCv3 driver) (diff)
downloadgentoobrowse-328338c9f1e2be3160e58223bef3e0121719d75b.tar.bz2
gentoobrowse-328338c9f1e2be3160e58223bef3e0121719d75b.tar.xz
gentoobrowse-328338c9f1e2be3160e58223bef3e0121719d75b.zip
Group by sync times instead of guessing at days
-rw-r--r--gentoobrowse/home.xslt28
-rw-r--r--gentoobrowse/views/newebuilds.xml10
2 files changed, 17 insertions, 21 deletions
diff --git a/gentoobrowse/home.xslt b/gentoobrowse/home.xslt
index 368d481..35fd4ef 100644
--- a/gentoobrowse/home.xslt
+++ b/gentoobrowse/home.xslt
@@ -11,26 +11,18 @@
<h2>Newest ebuilds</h2>
<table class="newebuilds">
<tr>
- <th>Today</th>
- <th>Yesterday</th>
- <th>The day before</th>
+ <xsl:for-each select="/gentoo/syncs/sync">
+ <th><xsl:value-of select="synctime" /></th>
+ </xsl:for-each>
</tr>
<tr>
- <td valign="top">
- <ul>
- <xsl:apply-templates select="/gentoo/newebuilds/ebuild[age=0]" />
- </ul>
- </td>
- <td valign="top">
- <ul>
- <xsl:apply-templates select="/gentoo/newebuilds/ebuild[age=1]" />
- </ul>
- </td>
- <td valign="top">
- <ul>
- <xsl:apply-templates select="/gentoo/newebuilds/ebuild[age=2]" />
- </ul>
- </td>
+ <xsl:for-each select="/gentoo/syncs/sync">
+ <td valign="top">
+ <ul>
+ <xsl:apply-templates select="/gentoo/newebuilds/ebuild[sync = current()/synctime]" />
+ </ul>
+ </td>
+ </xsl:for-each>
</tr>
</table>
</xsl:template>
diff --git a/gentoobrowse/views/newebuilds.xml b/gentoobrowse/views/newebuilds.xml
index 93d7286..1476533 100644
--- a/gentoobrowse/views/newebuilds.xml
+++ b/gentoobrowse/views/newebuilds.xml
@@ -3,14 +3,18 @@
<xi:include href="../datasources/postgres.xml" />
<project2:sqlview name="newebuilds" recordname="ebuild" datasource="postgres">
<sql>
- SELECT filename, description, moddate, p.name AS pkgname, c.name AS catname,
- EXTRACT('day' FROM ((SELECT MAX(fm.firstseen) FROM files fm) - (f.firstseen - interval '1hour'))) AS age
+ SELECT filename, description, moddate, p.name AS pkgname, c.name AS catname, f.firstseen sync
FROM ebuilds e, files f, packages p, categories c
WHERE e.ebuildid = f.fileid
AND e.packageid = p.packageid
AND p.categoryid = c.categoryid
- AND f.firstseen &gt; (SELECT MAX(fm.firstseen) - INTERVAL '2.1 days' FROM files fm)
+ AND f.firstseen &gt; (SELECT DISTINCT f.firstseen FROM files f ORDER BY f.firstseen DESC LIMIT 1 OFFSET 3)
ORDER BY c.name, p.name, e.versioninst
</sql>
</project2:sqlview>
+ <project2:sqlview name="syncs" recordname="sync" datasource="postgres">
+ <sql>
+ SELECT DISTINCT f.firstseen AS synctime FROM files f ORDER BY f.firstseen DESC LIMIT 3
+ </sql>
+ </project2:sqlview>
</block>