-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
refactors kudos data profile so the view/data/query is comprehensible #2662
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1567,25 +1567,28 @@ class Profile(SuperModel): | |
|
||
@property | ||
def get_my_kudos(self): | ||
from kudos.models import Token | ||
profile = self | ||
return Token.objects.select_related('kudos_transfer', 'contract').filter( | ||
Q(owner_address__iexact=profile.preferred_payout_address) | | ||
Q(kudos_token_cloned_from__recipient_profile=profile) | | ||
Q(kudos_transfer__recipient_profile=profile), | ||
contract__network=settings.KUDOS_NETWORK | ||
).distinct('id') | ||
from kudos.models import KudosTransfer | ||
kt_owner_address = KudosTransfer.objects.filter(kudos_token_cloned_from__owner_address__iexact=self.preferred_payout_address) | ||
kt_profile = KudosTransfer.objects.filter(recipient_profile=self) | ||
|
||
kudos_transfers = kt_profile | kt_owner_address | ||
kudos_transfers = kudos_transfers.filter(kudos_token_cloned_from__contract__network=settings.KUDOS_NETWORK) | ||
kudos_transfers = kudos_transfers.distinct('id') # remove this line IFF we ever move to showing multiple kudos transfers on a profile | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. E261 at least two spaces before inline comment |
||
|
||
return kudos_transfers | ||
|
||
|
||
@property | ||
def get_sent_kudos(self): | ||
from kudos.models import Token | ||
profile = self | ||
return Token.objects.select_related('kudos_transfer', 'contract').filter( | ||
Q(kudos_token_cloned_from__from_address__iexact=profile.preferred_payout_address) | | ||
Q(kudos_token_cloned_from__sender_profile=profile) | | ||
Q(kudos_transfer__sender_profile=profile), | ||
contract__network=settings.KUDOS_NETWORK, | ||
).distinct('id') | ||
from kudos.models import KudosTransfer | ||
kt_address = KudosTransfer.objects.filter(from_address__iexact=self.preferred_payout_address) | ||
kt_sender_profile = KudosTransfer.objects.filter(sender_profile=self) | ||
|
||
kudos_transfers = kt_address | kt_sender_profile | ||
kudos_transfers = kudos_transfers.filter(kudos_token_cloned_from__contract__network=settings.KUDOS_NETWORK) | ||
kudos_transfers = kudos_transfers.distinct('id') # remove this line IFF we ever move to showing multiple kudos transfers on a profile | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. E261 at least two spaces before inline comment |
||
|
||
return kudos_transfers | ||
|
||
@property | ||
def is_org(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (133 > 120 characters)