codeforamerica / cfapi

The Code for America API. Tracks and motivates activity and participation across the civic technology movement.
http://codeforamerica.org/api
MIT License
114 stars 53 forks source link

Stories returning in a random order? #153

Closed ondrae closed 10 years ago

ondrae commented 10 years ago

Description

Code for America's blog posts are being returned in a random order by the CfAPI. We should be returning from newest to oldest.

Example

http://codeforamerica.org/api/organizations/Code-for-America/stories

{
  "objects": [
    {
      "api_url": "http://codeforamerica.org/api/stories/100", 
      "id": 100, 
      "link": "http://www.codeforamerica.org/blog/2014/08/04/giselle-sperber-why-im-coding-for-america/", 
      ...
      "organization_name": "Code for America", 
      "title": "Giselle Sperber \u2013 Why I\u2019m Coding for America", 
      "type": "blog"
    }, 
    {
      "api_url": "http://codeforamerica.org/api/stories/495", 
      "id": 495, 
      "link": "http://www.codeforamerica.org/blog/2014/10/01/guest-post-from-omidyar-network-small-victories-lead-to-big-impact/", 
      ... 
      "organization_name": "Code for America", 
      "title": "Guest Post from Omidyar Network | Small Victories Lead to Big Impact", 
      "type": "blog"
    }, 
    {
      "api_url": "http://codeforamerica.org/api/stories/329", 
      "id": 329, 
      "link": "http://www.codeforamerica.org/blog/2014/09/15/govtech-fund-launch/", 
      ...
      "organization_name": "Code for America", 
      "title": "Why the Govtech Fund is a Really Big Deal", 
      "type": "blog"
    }, 
ondrae commented 10 years ago

To Fix

Add an ORDER BY filter to stories query https://github.com/codeforamerica/cfapi/blob/master/app.py#L667