Skip to content

Commit

Permalink
Update toplists of posts to:
Browse files Browse the repository at this point in the history
* Include all posters in the posting toplist, not just the teamless ones
* Include team name after poster name in the top list
* Change the team toplist to just list the team, not all members, since
  members are now listed in the main toplist.

Along the line, fix indent of text vs RSS button when overflowing to a
second line for long names (more common now that team names are included)
  • Loading branch information
mhagander committed Apr 20, 2010
1 parent 7c82d83 commit 24d593c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 33 deletions.
24 changes: 8 additions & 16 deletions generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,21 @@ def Generate(self):
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(*),NULL,NULL,NULL FROM planet.feeds
SELECT planet.feeds.name,blogurl,feedurl,count(*),planet.teams.name,planet.teams.teamurl,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
LEFT JOIN planet.teams ON planet.teams.id=planet.feeds.team
WHERE age(dat) < '1 month' AND approved AND NOT hidden GROUP BY planet.feeds.name,blogurl,feedurl,planet.teams.name,teamurl ORDER BY 4 DESC,1 LIMIT 20
""")

self.topposters = [PlanetFeed(feed) for feed in c.fetchall()]
if len(self.topposters) < 2: self.topposters = []

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;
""")
SELECT NULL,NULL,NULL,NULL,planet.teams.name, teamurl, count(*) FROM
planet.feeds
INNER JOIN planet.posts ON planet.feeds.id=planet.posts.feed
INNER JOIN planet.teams ON planet.teams.id=planet.feeds.team
WHERE age(dat) < '1 month' AND approved AND NOT hidden GROUP BY planet.teams.name, teamurl ORDER BY 7 DESC, 1 LIMIT 10""")

self.topteams = [PlanetFeed(feed) for feed in c.fetchall()]
if len(self.topteams) < 2: self.topteams = []
Expand Down
2 changes: 1 addition & 1 deletion template/base.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="alternate" type="application/rss+xml" title="Planet PostgreSQL" href="http://planet.postgresql.org/rss20.xml" />
<style type="text/css" media="screen" title="Normal Text">@import url("/css/planet.css");</style>
<style type="text/css" media="screen" title="Normal Text">@import url("css/planet.css");</style>
</head>
<body>
<div id="planetWrap">
Expand Down
18 changes: 4 additions & 14 deletions template/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
{% if topposters %}
<div class="planetRightTitle">Top posters</div>
<div class="planetRightDescription">Number of posts in the past month</div>
<ul>
<ul class="toplist">
{% for feed in topposters %}
<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>
<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%} {%if feed.teamname%}({{feed.teamname}}) {%endif%}- {{feed.numposts}}</li>
{% endfor %}
</ul>
{% endif %}
Expand All @@ -15,18 +15,8 @@
<div class="planetRightDescription">Number of posts in the past month</div>
<ul>
{% for feed in topteams %}
{% 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>
<li><a href="{{feed.teamurl}}">{{feed.teamname}}</a> - {{feed.teamcount}}</li>
{%endfor%}
</ul>
{% endif %}
<div class="planetRightTitle">Feeds</div>
Expand Down
14 changes: 12 additions & 2 deletions www/css/planet.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ div#planetMain {
}

div#planetLeft {
margin-right: 270px;
margin-right: 300px;
padding-top: 10px;
}

Expand Down Expand Up @@ -104,7 +104,7 @@ div.planetPostContent img {
}

div#planetRight {
width: 250px;
width: 280px;
margin-top: 10px;
float: right;
text-align: left;
Expand Down Expand Up @@ -142,6 +142,16 @@ a:visited { color:#004E66; text-decoration: underline; }
a:active { color:#0085B0; text-decoration: underline; }
a:hover { color:#000000; text-decoration: underline; }

/* Toplist on the right */
div#planetRight ul.toplist li {
padding-left: 20px;
}

div#planetRight ul.toplist li img {
margin-left: -20px;
float: left;
}

/* blog-specific hackery */
div.serendipity_authorpic {
display: block;
Expand Down

0 comments on commit 24d593c

Please sign in to comment.