Skip to content

Commit

Permalink
Merge pull request #1776 from adnankattekaden/dev
Browse files Browse the repository at this point in the history
socials karmaactivity log minor fix
  • Loading branch information
adnankattekaden authored Dec 7, 2023
2 parents 4c36295 + 08417db commit aff98c7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions api/dashboard/profile/profile_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Meta:
model = User
fields = ['profile_pic']


class UserProfileSerializer(serializers.ModelSerializer):
joined = serializers.DateTimeField(source="created_at")
level = serializers.CharField(source="user_lvl_link_user.level.name", default=None)
Expand Down Expand Up @@ -369,6 +370,7 @@ class Meta:

def update(self, instance, validated_data):
user_id = JWTUtils.fetch_user_id(self.context.get("request"))

def create_karma_activity_log(task_title, karma_value):
task = TaskList.objects.filter(title=task_title).first()
if task:
Expand All @@ -378,17 +380,20 @@ def create_karma_activity_log(task_title, karma_value):
user_id=user_id,
updated_by_id=user_id,
created_by_id=user_id,
appraiser_approved=True
peer_approved=True,
peer_approved_by_id=user_id,
appraiser_approved_by_id=user_id,
appraiser_approved=True,
)
Wallet.objects.filter(user_id=user_id).update(
karma=F("karma") + karma_value,
karma=F("karma") + karma_value,
updated_by_id=user_id
)

for account, account_url in validated_data.items():
old_account_url = getattr(instance, account)
if old_account_url != account_url:
#no need of extra checking for "" if only None equivalent to empty social url
# no need of extra checking for "" if only None equivalent to empty social url
if old_account_url in [None, ""] and account_url in [None, ""]:
pass
elif old_account_url is None or old_account_url == "":
Expand Down

0 comments on commit aff98c7

Please sign in to comment.