cfpb / idea-box

An application that lets an organization collect ideas, comment on them, and vote them up.
Creative Commons Zero v1.0 Universal
158 stars 49 forks source link

Fix add_idea when multiple States have no previous #76

Closed m3brown closed 9 years ago

m3brown commented 9 years ago

Background:

If a new state is created where newstate.previous == Null then the query for get_first_state returns two states, breaking Querysets that are looking for objects whose State is Active. Since the fixture linked below clearly states that the initial Active state has id=1, let's use that to identify the initial state.

Refer to https://github.com/cfpb/idea-box/blob/master/src/idea/fixtures/state.json which is loaded in the migrations

sephcoster commented 9 years ago

:+1: