Make memes require three unique voters. Prevent the readdition of items

to the sidebar.
This commit is contained in:
Sam Ruby 2007-12-07 06:49:00 -05:00
parent eb2ca9a7d4
commit 84d87f36b4
2 changed files with 9 additions and 2 deletions

View File

@ -80,6 +80,12 @@ def canonicalize(url):
revmap[canonurl] = url
return canonurl
def unique_votes(links):
voters = []
for weight, entry, feed, title, author, mtime in links:
if feed not in voters: voters.append(feed)
return len(voters)
log.debug("Loading cached data")
for name in glob.glob(os.path.join(cache, '*')):
# ensure that this is within the past week
@ -447,7 +453,7 @@ for i in range(0,len(weighted_links)):
voters.append(entry)
# add to the meme feed
if len(all_links[link]) > 2:
if unique_votes(all_links[link]) > 2:
meme_feed.addContent('\n')
entry = meme_feed.newChild(None, 'entry', None)
meme_feed.addContent('\n')

View File

@ -95,6 +95,7 @@ function addOption(event) {
var h2 = null;
for (var i=entries.length; --i>=0;) {
if (document.getElementById("news-" + i)) break;
if (entries[i].parent.offsetTop > 0) {
var a = entries[i].anchor = document.createElement('a');
a.id = "news-" + i;
@ -103,7 +104,7 @@ function addOption(event) {
}
}
if (h2 != null) {
if (h2 != null && !document.getElementById("navkeys")) {
h2.appendChild(document.createTextNode('Options'));
sidebar.appendChild(h2);