Skip to content

Refactor get_user_dashboard method in the dao/user.py file #545

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

Closed

Conversation

EfthymiaKostaki
Copy link
Contributor

@EfthymiaKostaki EfthymiaKostaki commented Apr 20, 2020

Description

This pull request alters the get_user_dashboard method in the dao/user.py file. Changes are made in two different ways. Firstly, we import copy class to use copy.deepcopy method for avoiding code repetition between as_mentor mentorship relations and as_mentee mentorship relations dictionary initialization. Secondly, we add a new method get_state used instead of iterating in a similar for loop multiple times.

Co-authoured with: @StergiosSozos

Fixes #418

Type of Change:

  • Code

Code/Quality Assurance Only

  • Refactoring (non-breaking change which fixes an issue)

How Has This Been Tested?

Pre-existing tests have the same outcome as they were before the code changed.

Checklist:

Delete irrelevant options.

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials

Code/Quality Assurance Only

  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

This method has as parameters mentor_or_mentee_received_or_sent and
mentorship_relation_state_wanted.

It's used to avoid repetitive code in get_user_dashboard method in the
same file. Returns a list of relevant relations.
@EfthymiaKostaki EfthymiaKostaki changed the title Refactor418 Refactor get_user_dashboard method in the dao/user.py file May 4, 2020
@devkapilbansal
Copy link
Member

@EfthymiaKostaki resolve the merge conflicts

@devkapilbansal devkapilbansal added the Status: Changes Requested Changes are required to be done by the PR author. label Feb 20, 2021
@vj-codes
Copy link
Member

@EfthymiaKostaki closing this PR due to inactivity
Let us know if you would like to continue again and thank you for your contribution :)

@vj-codes vj-codes closed this Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Changes Requested Changes are required to be done by the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

optimise code for repeated code in app/api/dao/user.py get_user_dashboard
3 participants