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

new profile data methods #5159

Merged
merged 8 commits into from
Sep 11, 2019
Merged

new profile data methods #5159

merged 8 commits into from
Sep 11, 2019

Conversation

owocki
Copy link
Contributor

@owocki owocki commented Sep 9, 2019

Description

this commit adds methods for calculating all the info needed on profiles to give them activity data

Refers/Fixes

#4908

Testing

locally

https://gitcoincore.slack.com/archives/CMGLVLSJX/p1568078390010700g

@codecov
Copy link

codecov bot commented Sep 9, 2019

Codecov Report

Merging #5159 into kevin/profile-v2 will increase coverage by 0.24%.
The diff coverage is 49.34%.

Impacted file tree graph

@@                 Coverage Diff                  @@
##           kevin/profile-v2    #5159      +/-   ##
====================================================
+ Coverage              30.9%   31.15%   +0.24%     
====================================================
  Files                   217      219       +2     
  Lines                 17622    17774     +152     
  Branches               2430     2460      +30     
====================================================
+ Hits                   5446     5537      +91     
- Misses                11953    11998      +45     
- Partials                223      239      +16
Impacted Files Coverage Δ
app/app/urls.py 89.36% <ø> (ø) ⬆️
...ashboard/management/commands/create_rep_records.py 0% <0%> (ø)
...board/management/commands/cleanup_dupe_profiles.py 0% <0%> (ø) ⬆️
app/dashboard/admin.py 63.94% <100%> (+0.88%) ⬆️
app/dashboard/points.py 100% <100%> (ø)
app/dashboard/views.py 13.7% <6.25%> (-0.08%) ⬇️
app/dashboard/models.py 57% <61.26%> (+1.14%) ⬆️
... and 1 more

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 31b2f71...480be13. Read the comment docs.

@iamonuwa
Copy link
Contributor

iamonuwa commented Sep 9, 2019

Super dope

@@ -2105,6 +2129,12 @@ class Profile(SuperModel):
help_text=_('override profile avatar'),
)
dominant_persona = models.CharField(max_length=25, choices=PERSONAS, blank=True)
longest_streak = models.IntegerField(default=0)
activity_level = models.CharField(max_length=10, blank=True, help_text=_('the users activity level (high, low, new)'))
Copy link
Contributor

Choose a reason for hiding this comment

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

did you forget medium? (I guess it's only the help text)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in the help text only yes

return "High"
if visits_last_month > med_threshold:
return "Medium"
if visits_last_month > med_threshold:
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be visits_last_month < med_threshold?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no; d1574cc


if visits_last_month > high_threshold:
return "High"
if visits_last_month > med_threshold:
Copy link
Contributor

@frankchen07 frankchen07 Sep 10, 2019

Choose a reason for hiding this comment

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

med_threshold is the same as high_threshold, does that make sense?

also - should there be an upper bound as well? (visits_last_month > med_threshold and <= high_threshold?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah.... it is.

alos i just made this up... you guys tell me what the thresholds should be pls. in particular, @frankchen07 curious your opionion

Copy link
Contributor

@frankchen07 frankchen07 Sep 11, 2019

Choose a reason for hiding this comment

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

I think it's fine where it is - 15 stands to be a visit every other day, medium is 2 visit per week, and lower than that is low.

if bounty.is_funder(self.handle):
for handle in fulfiller_handles:
relationships.append(handle)
if self.handle in fulfiller_handles:
Copy link
Contributor

Choose a reason for hiding this comment

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

nice this handles both funder -> fulfiller and and vice versa

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yar

eligible_bounties = bounties.filter(idx_status__in=['done', 'expired', 'cancelled'])

if eligible_bounties.count() == 0:
return -1
Copy link
Contributor

Choose a reason for hiding this comment

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

hm why -1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its a way of saying "this user hasnt done any bounties; pls dont display on frontend". as opposed to 0 which is for when the user has made $0/hr for many bounties

iterdate += timezone.timedelta(days=1)

is_weekday = iterdate.weekday() < 5
if not is_weekday:
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't weekends be counted in the streak as well?

also is the if not is_weekday grabbing weekends here? if its 5 or greater is_weekday is false and the if not will render true, and it'll continue, no?

Copy link
Contributor Author

@owocki owocki Sep 10, 2019

Choose a reason for hiding this comment

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

the if not weekday thing is an if statement that calls a continue which effectivbely skips weekend days

i dont think weekends should count in the streak mechanic.. we dont want to build a culture that encourages burnout

Copy link
Contributor Author

@owocki owocki left a comment

Choose a reason for hiding this comment

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

would <3 a review from @gitcoinco/engineers

if bounty.is_funder(self.handle):
for handle in fulfiller_handles:
relationships.append(handle)
if self.handle in fulfiller_handles:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

yar

eligible_bounties = bounties.filter(idx_status__in=['done', 'expired', 'cancelled'])

if eligible_bounties.count() == 0:
return -1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

its a way of saying "this user hasnt done any bounties; pls dont display on frontend". as opposed to 0 which is for when the user has made $0/hr for many bounties

@@ -2105,6 +2129,12 @@ class Profile(SuperModel):
help_text=_('override profile avatar'),
)
dominant_persona = models.CharField(max_length=25, choices=PERSONAS, blank=True)
longest_streak = models.IntegerField(default=0)
activity_level = models.CharField(max_length=10, blank=True, help_text=_('the users activity level (high, low, new)'))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

in the help text only yes


if visits_last_month > high_threshold:
return "High"
if visits_last_month > med_threshold:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah.... it is.

alos i just made this up... you guys tell me what the thresholds should be pls. in particular, @frankchen07 curious your opionion

@owocki owocki merged commit 480be13 into kevin/profile-v2 Sep 11, 2019
@thelostone-mc thelostone-mc deleted the kevin/profile-v2-data branch June 27, 2020 00:52
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.

3 participants