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

feat: Add avatars #331

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

feat: Add avatars #331

wants to merge 14 commits into from

Conversation

orronai
Copy link
Collaborator

@orronai orronai commented Oct 10, 2021

  • 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
@orronai orronai linked an issue Oct 10, 2021 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Oct 10, 2021

Codecov Report

Merging #331 (3052f0b) into master (9499e89) will increase coverage by 0.15%.
The diff coverage is 91.02%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
lms/lmsdb/bootstrap.py 16.52% <20.00%> (+0.07%) ⬆️
lms/models/users.py 92.45% <92.59%> (-0.14%) ⬇️
lms/lmsweb/views.py 93.17% <96.96%> (+0.23%) ⬆️
lms/lmsdb/models.py 91.96% <100.00%> (+0.01%) ⬆️
lms/lmsweb/__init__.py 97.82% <100.00%> (+0.15%) ⬆️
lms/lmsweb/forms/update_avatar.py 100.00% <100.00%> (ø)
lms/utils/consts.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9499e89...3052f0b. Read the comment docs.

.gitignore Outdated Show resolved Hide resolved
lms/lmsdb/models.py Outdated Show resolved Hide resolved
lms/lmsweb/forms/update_avatar.py Outdated Show resolved Hide resolved
lms/lmsweb/translations/he/LC_MESSAGES/messages.po Outdated Show resolved Hide resolved
return render_template('update-avatar.html', form=form)


@webapp.route('/avatar/delete')
Copy link
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
Collaborator Author

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
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

lms/models/users.py Show resolved Hide resolved
lms/templates/navbar.html Outdated Show resolved Hide resolved
tests/test_users.py Show resolved Hide resolved

@staticmethod
def open_file(filename: str) -> BufferedReader:
return open(Path(conftest.SAMPLES_DIR) / filename, 'br')
Copy link
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

tests/test_users.py Show resolved Hide resolved
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 19, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 1.67 ⭐ 1.64 ⭐ -0.03 👍
Method Length 36.29 ⭐ 36.27 ⭐ -0.02 👍
Working memory 6.56 🙂 6.54 🙂 -0.02 👍
Quality 81.75% 81.95% 0.20% 👍
Other metrics Before After Change
Lines 2461 2593 132
Changed files Quality Before Quality After Quality Change
lms/lmsdb/bootstrap.py 81.17% ⭐ 81.43% ⭐ 0.26% 👍
lms/lmsdb/models.py 84.12% ⭐ 84.12% ⭐ 0.00%
lms/lmsweb/init.py 64.84% 🙂 59.70% 🙂 -5.14% 👎
lms/lmsweb/views.py 75.40% ⭐ 75.73% ⭐ 0.33% 👍
lms/models/users.py 89.57% ⭐ 90.99% ⭐ 1.42% 👍
lms/utils/consts.py 90.75% ⭐ 90.29% ⭐ -0.46% 👎
tests/conftest.py 90.98% ⭐ 91.05% ⭐ 0.07% 👍
tests/test_users.py 83.50% ⭐ 84.31% ⭐ 0.81% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
lms/lmsweb/views.py comment 13 🙂 202 😞 8 🙂 50.15% 🙂 Try splitting into smaller methods
lms/lmsdb/models.py Solution.status 1 ⭐ 118 🙂 17 ⛔ 55.65% 🙂 Extract out complex expressions
lms/lmsweb/views.py view 8 ⭐ 140 😞 10 😞 56.16% 🙂 Try splitting into smaller methods. Extract out complex expressions
lms/lmsweb/views.py login 5 ⭐ 129 😞 12 😞 56.69% 🙂 Try splitting into smaller methods. Extract out complex expressions
lms/lmsdb/models.py Solution._base_next_unchecked 0 ⭐ 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 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.

Add avatars
2 participants