Permalink
Browse files

List which members are posting in a team, when a team is listed on

the toplist.
  • Loading branch information...
1 parent bc5d01a commit e079220f7411181fee74dad4e253470ffacd4ecf @mhagander committed Jun 22, 2009
Showing with 39 additions and 3 deletions.
  1. +22 −2 generator.py
  2. +6 −0 planethtml.py
  3. +11 −1 template/index.tmpl
View
@@ -77,12 +77,32 @@ def Generate(self):
description=desc))
self.items.append(PlanetPost(post[0], post[1], post[2], post[3], post[5], post[6], desc, post[8], post[9]))
- c.execute("SELECT name,blogurl,feedurl,count(*) FROM planet.feeds INNER JOIN planet.posts ON planet.feeds.id=planet.posts.feed WHERE age(dat) < '1 month' AND team IS NULL AND approved AND NOT hidden GROUP BY name,blogurl,feedurl ORDER BY 4 DESC,1 LIMIT 20")
+ c.execute("""
+SELECT name,blogurl,feedurl,count(*),NULL,NULL,NULL FROM planet.feeds
+INNER JOIN planet.posts ON planet.feeds.id=planet.posts.feed
+WHERE age(dat) < '1 month' AND team IS NULL AND approved AND NOT hidden GROUP BY name,blogurl,feedurl ORDER BY 4 DESC,1 LIMIT 20
+""")
+
for feed in c.fetchall():
self.topposters.append(PlanetFeed(feed))
if len(self.topposters) < 2: self.topposters = []
- c.execute("SELECT teams.name,teams.teamurl,NULL,count(*) FROM planet.teams INNER JOIN planet.feeds ON planet.feeds.team=planet.teams.id INNER JOIN planet.posts ON planet.feeds.id=planet.posts.feed WHERE age(dat) < '1 month' AND approved AND NOT hidden GROUP BY teams.name,teams.teamurl ORDER BY 4 DESC,1 LIMIT 10")
+ c.execute("""
+SELECT feedname,blogurl,feedurl,feedcount,teamname,teamurl,teamcount FROM
+ (SELECT team,name AS feedname,blogurl,feedurl,count(*) AS feedcount FROM planet.feeds
+ INNER JOIN planet.posts ON planet.feeds.id=planet.posts.feed
+ WHERE age(dat) < '1 month' AND approved AND NOT hidden GROUP BY team,name,blogurl,feedurl
+ ) AS q_feeds
+ INNER JOIN
+ (SELECT teams.id AS team,teams.name AS teamname,teams.teamurl,count(*) AS teamcount FROM planet.teams
+ INNER JOIN planet.feeds ON planet.feeds.team=planet.teams.id
+ INNER JOIN planet.posts ON planet.feeds.id=planet.posts.feed
+ WHERE age(dat) < '1 month' AND approved AND NOT hidden GROUP BY teams.id, teams.name, teams.teamurl ORDER BY 4 DESC,1 LIMIT 10
+ ) AS q_teams
+ON q_feeds.team=q_teams.team
+ORDER BY teamcount DESC, teamname, feedcount DESC, feedname;
+""")
+
for feed in c.fetchall():
self.topteams.append(PlanetFeed(feed))
if len(self.topteams) < 2: self.topteams = []
View
@@ -57,6 +57,9 @@ def __init__(self,row):
self._blogurl = row[1]
self._feedurl = row[2]
self.numposts = row[3]
+ self.teamname = row[4]
+ self._teamurl = row[5]
+ self.teamcount = row[6]
def _get_blogurl(self):
return quoteurl(self._blogurl)
@@ -66,3 +69,6 @@ def _get_feedurl(self):
return quoteurl(self._feedurl)
feedurl = property(_get_feedurl)
+ def _get_teamurl(self):
+ return quoteurl(self._teamurl)
+ teamurl = property(_get_teamurl)
View
@@ -13,8 +13,18 @@
<div class="planetRightTitle">Top teams</div>
<ul>
{% for feed in topteams %}
- <li><a href="{{feed.feedurl}}"><img src="img/feed-icon-14x14.png" alt="RSS"/></a> {%if feed.blogurl %}<a href="{{feed.blogurl}}">{{feed.name}}</a>{%else%}{{feed.name}}{%endif%} ({{feed.numposts}})</li>
+ {% ifchanged feed.teamname %}
+ {% if not forloop.first %}
+ </ul>
+ </li>
+ {% endif %}
+ <li><a href="{{feed.teamurl}}">{{feed.teamname}}</a> ({{feed.teamcount}})
+ <ul>
+ {%endifchanged%}
+ <li><a href="{{feed.feedurl}}"><img src="img/feed-icon-14x14.png" alt="RSS"/></a> {%if feed.blogurl %}<a href="{{feed.blogurl}}">{{feed.name}}</a>{%else%}{{feed.name}}{%endif%} ({{feed.numposts}})</li>
{% endfor %}
+ </ul>
+ </li>
</ul>
{% endif %}
<div class="planetRightTitle">Feeds</div>

0 comments on commit e079220

Please sign in to comment.