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

Refactor correct username of contributors #1751

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

Sujanadh
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Related Issue

Describe this PR

This PR refactors an existing function to get project users to get the correct username of contributors instead of returning the username of logged-in users.

  • refactored to use single sql to avoid multiple db calls.

Screenshots

Please provide screenshots of the change.

Alternative Approaches Considered

Did you attempt any other approaches that are not documented in code?

Review Guide

Notes for the reviewer. How to test this change?

Checklist before requesting a review

[optional] What gif best describes this PR or how it makes you feel?

@Sujanadh Sujanadh requested a review from spwoodcock August 12, 2024 08:42
@Sujanadh Sujanadh self-assigned this Aug 12, 2024
@github-actions github-actions bot added bug Something isn't working backend Related to backend code labels Aug 12, 2024
response = sorted(response, key=lambda x: x["contributions"], reverse=True)
return response
query = text("""
SELECT u.username, COUNT(th.user_id) as contributions
Copy link
Member

Choose a reason for hiding this comment

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

πŸ™Œ

@spwoodcock spwoodcock merged commit ce1b3b4 into development Aug 13, 2024
5 checks passed
@spwoodcock spwoodcock deleted the fix/contributors-username branch August 13, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend code bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants