Skip to content

feat: Add avatars - #331

Open
orronai wants to merge 14 commits into
masterfrom
edit-profile
Open

feat: Add avatars#331
orronai wants to merge 14 commits into
masterfrom
edit-profile

Conversation

@orronai

Copy link
Copy Markdown
Collaborator
  • Added avatars to users tables
  • Added a template in order to change or delete avatar
  • Added the form and validators for the picture file
  • Added tests
  • Added translations
  • Added to the navbar near the username the avatar (if the user has one)
  • Added to gitignore the avatars

- Added avatars to users tables
- Added a template in order to change or delete avatar
- Added the form and validators for the picture file
- Added tests
- Added translations
- Added to the navbar near the username the avatar (if the user has one)
- Added to gitignore the avatars
@orronaiorronai linked an issue Oct 10, 2021 that may be closed by this pull request
@codecov

codecovBot commented Oct 10, 2021

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.02564% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.34%. Comparing base (9499e89) to head (3052f0b).
⚠️ Report is 39 commits behind head on master.

Files with missing linesPatch %Lines
lms/lmsdb/bootstrap.py20.00%4 Missing ⚠️
lms/models/users.py92.59%2 Missing ⚠️
lms/lmsweb/views.py96.96%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## master #331 +/- ##
==========================================
+ Coverage 84.18% 84.34% +0.15% 
==========================================
Files 63 64 +1 Lines 2953 3027 +74 ==========================================
+ Hits 2486 2553 +67 - Misses 467 474 +7 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread.gitignore Outdated
Comment threadlms/lmsdb/models.py Outdated
Comment threadlms/lmsweb/forms/update_avatar.py Outdated
Comment threadlms/lmsweb/translations/he/LC_MESSAGES/messages.po Outdated
Comment threadlms/lmsweb/views.py
return render_template('update-avatar.html', form=form)


@webapp.route('/avatar/delete')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you can make it work with the DELETE http verb it'll be awesome. If not, that's also good

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

for delete http verb we can't just use html - we need also JS functions so I think it'd be more complicated. In addition - because of the implementation of this delete function - we redirect to the users page which is a get method according to my opinion

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah that's PITA. Agree

Comment threadlms/models/users.py
Comment threadlms/templates/navbar.html
Comment threadtests/test_users.py
Comment threadtests/test_users.py

@staticmethod
def open_file(filename: str) -> BufferedReader:
return open(Path(conftest.SAMPLES_DIR) / filename, 'br')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can do it with fixture: use file_handler = open(...), then yield file_handler and finally file_handler.close it

Comment threadtests/test_users.py
@sourcery-ai

Copy link
Copy Markdown

Sourcery Code Quality Report

✅ Merging this PR will increase code quality in the affected files by 0.20%.

Quality metricsBeforeAfterChange
Complexity1.67 ⭐1.64 ⭐-0.03 👍
Method Length36.29 ⭐36.27 ⭐-0.02 👍
Working memory6.56 🙂6.54 🙂-0.02 👍
Quality81.75%81.95%0.20% 👍
Other metricsBeforeAfterChange
Lines24612593132
Changed filesQuality BeforeQuality AfterQuality Change
lms/lmsdb/bootstrap.py81.17% ⭐81.43% ⭐0.26% 👍
lms/lmsdb/models.py84.12% ⭐84.12% ⭐0.00%
lms/lmsweb/init.py64.84% 🙂59.70% 🙂-5.14% 👎
lms/lmsweb/views.py75.40% ⭐75.73% ⭐0.33% 👍
lms/models/users.py89.57% ⭐90.99% ⭐1.42% 👍
lms/utils/consts.py90.75% ⭐90.29% ⭐-0.46% 👎
tests/conftest.py90.98% ⭐91.05% ⭐0.07% 👍
tests/test_users.py83.50% ⭐84.31% ⭐0.81% 👍

Here are some functions in these files that still need a tune-up:

FileFunctionComplexityLengthWorking MemoryQualityRecommendation
lms/lmsweb/views.pycomment13 🙂202 😞8 🙂50.15% 🙂Try splitting into smaller methods
lms/lmsdb/models.pySolution.status1 ⭐118 🙂17 ⛔55.65% 🙂Extract out complex expressions
lms/lmsweb/views.pyview8 ⭐140 😞10 😞56.16% 🙂Try splitting into smaller methods. Extract out complex expressions
lms/lmsweb/views.pylogin5 ⭐129 😞12 😞56.69% 🙂Try splitting into smaller methods. Extract out complex expressions
lms/lmsdb/models.pySolution._base_next_unchecked0 ⭐95 🙂20 ⛔57.42% 🙂Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

Sign up for freeto 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.

Add avatars

2 participants

@orronai@yammesicka