Add Api to receive the popular bills. (Task #2740)


Added by Benny Weingarten over 2 years ago. Updated over 1 year ago.


Status:Closed Start date:02/13/2012
Priority:Normal Due Date::
Assignee:Tomer Harpaz % Done:

100%

Category:- Spent time: -
Target version:-
מתאים כמטלה ראשונה:No

Description

The homepage of OKnesset.org shows a random bill, selected from a pool of popular bills.
The code that selects this random bill is located in auxiliary/views.py:

bill_votes = [x['object_id’] for x in voting.models.Vote.objects.get_popular(Bill)]
if bill_votes:
context['bill’] = Bill.objects.get(pk=random.choice(bill_votes))

There should be an API call to receive this list.


History

Updated by דוד שמעון over 2 years ago

What should be the call?
http://oknesset.org/api/bill/popular/ ?
or maybe
http://oknesset.org/api/popular/bill

and maybe we will want to see popular positive and poplular negative?

Updated by Benny Weingarten over 2 years ago

I think http://oknesset.org/api/bill/popular/ is more suitable since we are fetching bills.

top positive and top negative - perhaps by adding a get parameter:

http://oknesset.org/api/bill/popular/?type=positive
http://oknesset.org/api/bill/popular/?type=negative

Updated by עפרי רביב almost 2 years ago

i refactored the logic that selects the bills out of the main view. its now available in src/knesset/laws/models.py in get_debated_bills(), so writing the API for it should be easier.

Updated by Tomer Harpaz over 1 year ago

  • % Done changed from 0 to 100
  • Assignee set to Tomer Harpaz
  • Status changed from New to Closed

Also available in: Atom PDF