ushahidi / SwiftRiver-API

An API for external (third party) applications to post and consume data to/from SwiftRiver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect drop_id used when adding drop to bucket on creation of a new drop (the bucket_drop_id value gets set at the drop_id value)

dan-king opened this issue · comments

Supposed there is an empty bucket with ID 274. Specifying bucked 274 in the creation of the drop does create the drop and does put it in bucket 274.

However, when the bucket is listed, the drop id has an incorrect value. It shows the drop_bucket_id, not the drop_id.

Below is an example response of creating new drop and added it to bucket 274 in a single request. Note that the new drop id is is 1595, but when listing drops in the bucket the drop has an incorrect id value of 8. (This is the value of the bucket_drop_id, not drop_id of 1595.)

[
{
"id": 1595,
"title": "#Everett #Earthquake Friday Test",
"content": "Earthquake in Everett, WA. Friday Test",
"channel": "rss",
"image": "",
"tags": [],
"links": [],
"media": [],
"places": [
{
"id": 704,
"type": null,
"longitude": -122.21403,
"latitude": 47.984653,
"name": "Everett"
},
{
"id": 703,
"type": null,
"longitude": -122.2,
"latitude": 48,
"name": "USA"
}
],
"read": null,
"forms": null,
"source": {
"id": 59,
"name": "Dan King",
"username": "@viewpointpro",
"avatar": ""
},
"date_published": "Wed, 6 Mar 2013 19:06:45 -0800",
"user_score": 0,
"original_url": "http://www.viewpoint.pro/Drop_A",
"original_id": "http://www.viewpoint.pro/Drop_A",
"comment_count": 0,
"buckets": null
}
]

But when the bucket is listed, the drop id is shows as 8 (the bucket_drop_id), not 1595 as it should be.

[
{
"id": 8,
"title": "#Everett #Earthquake Friday Test",
"content": "Earthquake in Everett, WA. Friday Test",
"channel": "rss",
"image": null,
"tags": [],
"links": [],
"media": null,
"places": [
{
"id": 703,
"type": null,
"longitude": -122.2,
"latitude": 48,
"name": "USA"
},
{
"id": 704,
"type": null,
"longitude": -122.214,
"latitude": 47.9847,
"name": "Everett"
}
],
"read": false,
"forms": null,
"source": {
"id": 59,
"name": "Dan King",
"username": null,
"avatar": ""
},
"date_published": "Wed, 6 Mar 2013 19:06:45 -0800",
"user_score": 0,
"original_url": null,
"original_id": "http://www.viewpoint.pro/Drop_A",
"comment_count": 0,
"buckets": [
{
"bucket_drop_id": 8,
"id": 274,
"name": "AAA My Friday Bucket"
}
]
}
]

@dan-king I'll review this.

We made some trade-offs that made sense at the time of implementation but that may not longer be the case.