Charcoal-SE / metasmoke

Web dashboard for SmokeDetector.
https://metasmoke.erwaysoftware.com
Creative Commons Zero v1.0 Universal
43 stars 34 forks source link

API Response: Add count of number of is_* attributes #41

Closed AWegnerGitHub closed 7 years ago

AWegnerGitHub commented 8 years ago

When a post receives feedback from multiple users, it'd be helpful to know how many of each type (is_fp, is_tp, and is_naa) were received.

For example, post https://metasmoke.erwaysoftware.com/post/44634 received 2 is_tp and 1 is_naa and has a response object that looks like this:

{   'has_more': False,
    'items': [   {   u'body': <snipped for brevity>,
                     u'created_at': u'2016-10-25T09:50:45.000Z',
                     u'downvote_count': None,
                     u'id': 44634,
                     u'is_fp': False,
                     u'is_tp': True,
                     u'link': u'//superuser.com/a/1138708',
                     u'post_creation_date': None,
                     u'score': None,
                     u'site_id': 3,
                     u'stack_exchange_user_id': 37707,
                     u'title': u'What are all the "about:" pages, in Internet Explorer?',
                     u'updated_at': u'2016-10-25T10:11:20.000Z',
                     u'upvote_count': None,
                     u'user_link': u'//superuser.com/u/656344',
                     u'user_reputation': 1,
                     u'username': u'user656344',
                     u'why': u'Post - Contains 10 unique characters'}],
    'page': 1,
    'total': 1}

If there could be three new attributes showing the count of each, that'd be helpful. Example:

count_tp: 2,
count_fp: 0,
count_naa: 1,

An alternative to adding three new attributes, is changing the existing (and new) is_* attributes from a boolean to an integer.

ArtOfCode- commented 8 years ago

Gonna take this one. Shouldn't be much more than moving an existing route to use a jbuilder view and a join. Possibly a day or two before I can work on it, though.

ArtOfCode- commented 7 years ago

Gonna have to drop this one again - unexpected things came up, and I'm gone for a few days to sort them out. Will get round to it when I get back, if @Undo1 doesn't want it.

angussidney commented 7 years ago

Currently FDSC does this by making a second request to the /api/post/:id/feedback route, then counting the number of feedbacks of each type. You could use that approach in the meantime until Art gets a chance to fix it.

Although, it would be much more efficient (both time and network wise) to include this in the original request.

angussidney commented 7 years ago

@ArtOfCode- any updates on the status of this?