Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(like dislike count): add like dislike functionality #35

Merged
merged 1 commit into from
Dec 19, 2018

Conversation

salma-nyagaka
Copy link
Contributor

What does this PR do?

This PR adds a count to the like and dislike field

Description of tasks to be completed

Use the following endpoints to test the functionality that has been implemented.
Method Endpoint Description
GET /api/articles/ Get an article

How should this be manually tested

  • Clone the GitHub repository git clone https://github.com/andela/ah-technocrats
  • Checkout to the branch git checkout fix-like-dislike-162759444
  • Create a virtual environment virtualenv venv
  • Install the dependencies pip install -r requiremnts.txt
  • Run migrations python manage.py makemigrations python manage.py migrate
  • Test the application python manage.py test
  • Test with postman after running python manage.py runserver

Any background context you want to provide?

The like and dislike should display the total count it has

What are the relevant pivotal tracker stories?
#162759444(https://www.pivotaltracker.com/story/show/162759444)

Checklist:

  • My code follows the style guidelines of this project
  • At least 2 people have reviewed my PR
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • My PR has one commit.

Count for dislikes

aa

Count for likes

a

- modify the serializer method
- modify the view for dislike

[Delivers #162759444]

def likes(self, instance):

def like_article(self, instance):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.


def dislikes(self, instance):
def dislike_article(self, instance):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Dec 19, 2018

Code Climate has analyzed commit c28cf93 and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 4

View more on Code Climate.

Copy link

@Mnickii Mnickii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mnickii Mnickii merged commit 8413ff5 into develop Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants