andela / ah-infinity-stones

BSD 3-Clause "New" or "Revised" License
0 stars 3 forks source link

#161966917 Implement article rating functionality #47

Closed codeplus254 closed 5 years ago

codeplus254 commented 5 years ago

What does this PR do?

}

-  To rate an article, copy and paste the slug ( in this case `how-to-make-it-rain`) into the url and make a POST request to `http://127.0.0.1:8000/api/articles/<slug>/rate` (eg. ` http://127.0.0.1:8000/api/articles/how-to-make-it-rain/rate` ) with the following data:

{ "rating": "4" }



- To view all the ratings for a particular post use the same url but make a GET request.
      `http://127.0.0.1:8000/api/articles/<slug>/rate` (eg. ` http://127.0.0.1:8000/api/articles/how-to-make-it-rain/rate` ) 
- In order to view the article's rating average simply visit the following url(not forgetting your slug).
`http://127.0.0.1:8000/api/articles/<slug>` (eg. ` http://127.0.0.1:8000/api/articles/how-to-make-it-rain` ) 

8. Run tests`python3 manage.py test authors.apps.articles.tests.test_views.ArticleRatingTestCase`
#### What are the relevant pivotal tracker stories?
[#161966917](https://www.pivotaltracker.com/story/show/161966917)
#### Screenshots
<img width="1125" alt="screenshot 2018-12-19 at 20 58 26" src="https://user-images.githubusercontent.com/16904946/50252083-f217e080-03f6-11e9-8a02-bc08829acf73.png">
<img width="1118" alt="screenshot 2018-12-19 at 21 00 46" src="https://user-images.githubusercontent.com/16904946/50252086-f3e1a400-03f6-11e9-8f02-e3088e2b8abb.png">
<img width="1119" alt="screenshot 2018-12-19 at 21 01 05" src="https://user-images.githubusercontent.com/16904946/50252092-f9d78500-03f6-11e9-8f6c-d834b10eee95.png">
<img width="1123" alt="screenshot 2018-12-19 at 21 01 36" src="https://user-images.githubusercontent.com/16904946/50252096-ff34cf80-03f6-11e9-8367-d6cd61d92459.png">
<img width="1120" alt="screenshot 2018-12-19 at 23 27 33" src="https://user-images.githubusercontent.com/16904946/50252099-01972980-03f7-11e9-9c35-459fc700599e.png">
<img width="997" alt="screenshot 2018-12-19 at 20 33 54" src="https://user-images.githubusercontent.com/16904946/50252105-052ab080-03f7-11e9-99c0-173f8860ef24.png">
kamyaD commented 5 years ago

@codeplus254 Great work on this project. I tried to look at Travis and it says, Build has been terminated, could you kindly check on it?

r-wambui commented 5 years ago

@codeplus254 Check why the article rating model can be created test is failing.

codeclimate[bot] commented 5 years ago

Code Climate has analyzed commit 98379d7b and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.