passiomatic / coldsweat

Web RSS aggregator and reader compatible with the Fever API
MIT License
146 stars 21 forks source link

No next entry when browsing Pinboard "popular" feed #65

Open passiomatic opened 10 years ago

passiomatic commented 10 years ago

PInboard "popular" feed entries have all the same timestamp. E.g:

<item rdf:about="http://www.fullstackpython.com/">
    <title>Full Stack Python</title>
    <dc:date>2014-07-06T14:12:01+00:00</dc:date>
    <link>http://www.fullstackpython.com/</link>
    <dc:creator>davewongillies</dc:creator><description><![CDATA[This guide has a different focus from the above resources. Here I focus on explaining several ways of setting up a Python web application stack from server infrastructure through JavaScript execution on a user's browser.]]></description>
<dc:subject>python webdev linux</dc:subject>
<dc:source>http://delicious.com/</dc:source>
<dc:identifier>http://pinboard.in/u:davewongillies/b:23e4d9f9664a/</dc:identifier>
<taxo:topics><rdf:Bag>  <rdf:li rdf:resource="http://pinboard.in/u:davewongillies/t:python"/>
    <rdf:li rdf:resource="http://pinboard.in/u:davewongillies/t:webdev"/>
    <rdf:li rdf:resource="http://pinboard.in/u:davewongillies/t:linux"/>
</rdf:Bag></taxo:topics>
</item>
<item rdf:about="http://apenwarr.ca/log/?m=201407#01">
    <title>apenwarr: The curse of smart people</title>
    <dc:date>2014-07-06T14:12:01+00:00</dc:date>
    <link>http://apenwarr.ca/log/?m=201407#01</link>
    <dc:creator>mechazoidal</dc:creator><description><![CDATA[It can be easy for very smart people to wall themselves away from the world and rationalize away everything.]]></description>
<dc:subject>culture intelligence post</dc:subject>
<dc:identifier>http://pinboard.in/u:mechazoidal/b:a540d0137946/</dc:identifier>
<taxo:topics><rdf:Bag>  <rdf:li rdf:resource="http://pinboard.in/u:mechazoidal/t:culture"/>
    <rdf:li rdf:resource="http://pinboard.in/u:mechazoidal/t:intelligence"/>
    <rdf:li rdf:resource="http://pinboard.in/u:mechazoidal/t:post"/>
</rdf:Bag></taxo:topics>
</item>

Note that both dc:date elements are set to 2014-07-06T14:12:01+00:00.

This poses a problem since Coldsweat to figure out the next entry to show check entry timestamps and sort it:

n = q.where(Entry.last_updated_on < entry.last_updated_on).order_by(Entry.last_updated_on.desc()).limit(1)

To fix this is necessary to apply two sort and condition parameters: last_updated_on and id. Note that Peewee order_by() method accepts multiple clauses.

passiomatic commented 10 years ago

Gonna mark won't fix this. There's little Coldsweat could do to handle this corner-case.

passiomatic commented 10 years ago

First option: Extract all entries from a feed, sort asc by their timestamp and then add them to the database. By relying on ID database autoincrement field we are sure entries will maintain they order, even if timestamps are all equal. Later, in the views sort by ID's desc, not timestamp. Older entries will be on bottom (smal ID's), recent entries on top. Second option: Use a greater fetcher "add time" accuracy, down to microseconds maybe, instead of relying to entry published date. This mirrors what Google Reader API expects, so it might be a better solution overall.