-
Notifications
You must be signed in to change notification settings - Fork 449
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
enhanced code of user.py with dict.get() #1116
Conversation
@aakankshaagr the build check is failing , can you please look into it ? |
sure @vj-codes !! I looked into tests and found that the test case is failing bcz test is to check " " to be treated as none and I guess it's happening bcz of use of dict.get() as it returns none only when the key is absent. If the key is present it will return whatever value user has given. Here there is an error related to timestamp. I don't know how to remove this error. So tests are failing bcz there is an error and a test fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @aakankshaagr thanks for this
There are some more places where this method can be used, like from line 42-47 (mentioned in issue too). Kindly look into the same
Hi @devkapilbansal thanks for helping me out. I thought earlier that its not needed there but I guess using dict.get() there initializes empty values with None. I missed this point earlier |
I made the changes but still tests are failing |
First of all, please update your code with current develop |
Codecov Report
@@ Coverage Diff @@
## develop #1116 +/- ##
===========================================
- Coverage 96.00% 94.01% -1.99%
===========================================
Files 96 38 -58
Lines 5309 2040 -3269
===========================================
- Hits 5097 1918 -3179
+ Misses 212 122 -90
|
@devkapilbansal @codesankalp please check if any changes are required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @aakankshaagr please rebase your branch to current develop. j
Also, there are some minor changes as suggested below 👇
app/api/dao/user.py
Outdated
@@ -244,73 +244,46 @@ def update_user_profile(user_id: int, data: Dict[str, str]): | |||
user.username = username | |||
|
|||
if "name" in data and data["name"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need these if conditions too
app/api/dao/user.py
Outdated
@@ -244,73 +244,46 @@ def update_user_profile(user_id: int, data: Dict[str, str]): | |||
user.username = username | |||
|
|||
if "name" in data and data["name"]: | |||
user.name = data["name"] | |||
user.name = data.get("name", None) or None | |||
|
|||
if "bio" in data: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above similar for other cases as well
app/api/dao/user.py
Outdated
current_password = data.get("current_password", None) | ||
new_password = data.get("new_password", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None can be removed here as it is the default value returned
current_password = data.get("current_password", None) | |
new_password = data.get("new_password", None) | |
current_password = data.get("current_password") | |
new_password = data.get("new_password") |
Hi @aakankshaagr why this PR is closed?? |
Hi @devkapilbansal earlier my branch wasn't updated with current develop even though I haven't forgotten to do a git pull to update my codebase and here I needed to rebase my branch to current develop. |
Description
Fixes #1065
Type of Change:
How Has This Been Tested?
Tested on my local pc
Checklist:
Code/Quality Assurance Only