hhroc / yellr-server

Server for yellr project
GNU Affero General Public License v3.0
6 stars 5 forks source link

Only return answer list if question type is poll, and return as a list #209

Closed thequbit closed 9 years ago

thequbit commented 9 years ago

For get_assignments.json, only return the answer list if it's a poll, and return them as an array.

gregjurman commented 9 years ago

Here is an example of a refactored assignment object. The answers key can be set to false denoting free-form (or excluded entirely for that totally worth it 15-byte minification) or an array for multiple-choice.

geofence contains the rectangle for fencing specific assignments, and can be excluded to denote 'global' assignments.

organization just contains the organization's ID and name for use client-side for display and querying the server for additional data if user requests more info on the specific org.

{
    "assignments": [
        {
            "assignment_id": 1,
            "description": "Tell me how you really feel about broccoli.  Be as detailed as you want!",
            "question": "How do you feel about broccoli?",
            "geofence": {
                "tl": {"lat": 43.7, "long": -77.9},
                "br": {"lat": 42.5, "long": -73.9},
            },
            "answers": false,
            "expire_datetime": "2014-09-21 16:03:11.435792",
            "publish_datetime": "2014-08-22 16:03:11.435785",
            "organization": {
                "id": 1,
                "name": "Yellr"
            },
            "post_count": 14
        }
    ],
    "success": true
}
thequbit commented 9 years ago

No longer applicable with server re-write. Closing. Docs for new end-points will be available soon.