coralproject / pillar

Deprecated: Service layer for the Coral ecosystem
Other
4 stars 1 forks source link

Issue#155 #161

Closed gabelula closed 8 years ago

gabelula commented 8 years ago

What does this PR do?

Changes the endpoint api/form_submissions/{form_id} to return count on totals of searches for filter_by , order_by and counting on flags.

How do I test this PR?

127.0.0.1:8080/api/form_submissions/5751ef7310780b96f002a3ad?filterby=test_the_flag

should return something like

{
    "count": {
        "total_per_flag": {
            "test_the_flag": 1
        },
        "total_search": 1,
        "total_submissions": 2
    },
    "submissions": [
        {
            "id": "5751ef7310780b96f002a3af",
            "form_id": "5751ef7310780b96f002a3ad",
            "status": "",
            "replies": [
                {
                    "widget_id": "1",
                    "identity": false,
                    "answer": "Gophers everywhere",
                    "edited": "This is an edit! Purple Monkey Dishwasher.",
                    "question": "Is there anybody out there?",
                    "props": {
                        "a": "B",
                        "c": 4
                    }
                },
                {
                    "widget_id": "2",
                    "identity": false,
                    "answer": "Dave",
                    "edited": "This is an edit! Purple Monkey Dishwasher.",
                    "question": "Name",
                    "props": {
                        "a": "B",
                        "c": 4
                    }
                },
                {
                    "widget_id": "3",
                    "identity": false,
                    "answer": "D@ve.name",
                    "edited": "This is an edit! Purple Monkey Dishwasher.",
                    "question": "Email",
                    "props": {
                        "a": "B",
                        "c": 4
                    }
                }
            ],
            "flags": [
                "test_the_flag"
            ],
            "header": {
                "description": "of the rest of your life",
                "title": "This is the first form"
            },
            "footer": {
                "conditions": "lots of conditions"
            },
            "finishedScreen": null,
            "created_by": "",
            "updated_by": "",
            "date_created": "2016-06-03T16:58:27.56-04:00",
            "date_updated": "2016-06-03T16:58:27.56-04:00"
        }
    ]
}

/cc @jde

@coralproject/backend

gabelula commented 8 years ago

I'm still working on the tests (finishing them) but I want to push this so front-end can use it.

impronunciable commented 8 years ago

Looks good to me