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

Users list #4011

Merged
merged 34 commits into from
Apr 11, 2019
Merged

Users list #4011

merged 34 commits into from
Apr 11, 2019

Conversation

octavioamu
Copy link
Contributor

@octavioamu octavioamu commented Mar 20, 2019

Description
Checklist
Affected core subsystem(s)
Refers/Fixes

Refs: #4019

Testing and Sign-off
Contributor
  • Read and followed the Contributor Guidelines
  • Tested all changes locally
  • Verified existing functionality
  • Ran make test and everything passed!
Reviewer
  • Affirm contributor guidelines have been followed and requested changes made
  • CI tests and linting pass
  • No conflicts (migrations, files, etc)
  • Regression tested against staging or local deployment
Funder
  • Validated requested changes were made to specification
  • Bounty payout released to the contributor

@codecov
Copy link

codecov bot commented Mar 20, 2019

Codecov Report

Merging #4011 into master will decrease coverage by <.01%.
The diff coverage is 14.28%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #4011      +/-   ##
=========================================
- Coverage   30.01%     30%   -0.01%     
=========================================
  Files         205     205              
  Lines       16000   16007       +7     
  Branches     2111    2111              
=========================================
+ Hits         4802    4803       +1     
- Misses      11026   11032       +6     
  Partials      172     172
Impacted Files Coverage Δ
app/app/urls.py 90% <ø> (ø) ⬆️
app/dashboard/views.py 11.94% <14.28%> (+0.01%) ⬆️

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 d83f930...dd1c620. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 20, 2019

Codecov Report

Merging #4011 into master will increase coverage by 0.1%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #4011     +/-   ##
=========================================
+ Coverage   30.26%   30.37%   +0.1%     
=========================================
  Files         206      206             
  Lines       16370    16397     +27     
  Branches     2152     2154      +2     
=========================================
+ Hits         4955     4981     +26     
+ Misses      11239    11236      -3     
- Partials      176      180      +4
Impacted Files Coverage Δ
app/app/urls.py 90% <ø> (ø) ⬆️
app/dashboard/views.py 13.8% <77.77%> (+1.55%) ⬆️
app/dashboard/models.py 54.19% <0%> (+0.12%) ⬆️
app/economy/models.py 61% <0%> (+3%) ⬆️

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 4be359b...7c9bae3. Read the comment docs.

@owocki owocki requested review from danlipert, thelostone-mc and owocki and removed request for danlipert April 10, 2019 20:23
@owocki
Copy link
Contributor

owocki commented Apr 10, 2019

hey @PixelantDesign @danlipert i spoke with @octavioamu this morning. we were thinking about releasing this this week so it can be used in the ethereal hackathon ( what exists now => http://bits.owocki.com/1cba8654c7ba/Image%202019-04-10%20at%202.23.46%20PM.png is basic search )

then we will build in the fuller features #4019 from there

i think we

  1. dont list this anywhere and just use it internally
  2. slap a 'beta' tag on it
  3. make it so you can only use it if logged in and you're an admin
  4. make the PR in a non-draft state

how does that sound?

@PixelantDesign
Copy link
Contributor

Works for me if it's in a good enough state. Though, I have not tested.

@octavioamu octavioamu marked this pull request as ready for review April 11, 2019 15:00
Copy link
Contributor

@danlipert danlipert left a comment

Choose a reason for hiding this comment

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

Almost there 👍

</button>

<div class="collapse navbar-collapse" id="usersFilters">
<!-- <div class="navbar-nav mr-4">
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats up with this fat comment? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is for the next version

username="user{}".format(i))
profile = Profile.objects.create(user=user, data={}, handle="{}".format(i))

def test_user_list(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

nice! :D

context = {}
user_list = Profile.objects.all().order_by(order_by).filter(handle__icontains=q).cache()

# all_notifs = Notification.objects.filter(to_user_id=request.user.id).order_by('-id')
Copy link
Contributor

Choose a reason for hiding this comment

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

leftover comment

@require_GET
def users_fetch(request):
"""Handle displaying users."""
q = request.GET.get('search','')
Copy link
Contributor

Choose a reason for hiding this comment

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

add a space before the final string here like q = request.GET.get('search', '')

all_pages = Paginator(user_list, limit)
all_users = []
for user in all_pages.page(page):
print(user)
Copy link
Contributor

Choose a reason for hiding this comment

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

leftover debugging print?

profile_json = {}
profile_json = user.to_standard_dict()
if user.avatar_baseavatar_related.exists():
profile_json['avatar_id'] = user.avatar_baseavatar_related.first().pk
Copy link
Contributor

Choose a reason for hiding this comment

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

Better here to assign a var to user.avatar_baseavatar_related.first() and then access the .pk and .avatar_url from that var. Calling .first() multiple times re-queries the database

@danlipert danlipert merged commit aa29b71 into master Apr 11, 2019
@thelostone-mc thelostone-mc deleted the users-list branch July 4, 2019 14:57
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.

5 participants