Skip to content

Commit

Permalink
Merge pull request #1798 from gtech-mulearn/dev
Browse files Browse the repository at this point in the history
delete karma activity log entry
  • Loading branch information
adnankattekaden authored Dec 11, 2023
2 parents cd99c66 + a3421b5 commit c538f7b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/dashboard/profile/profile_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def create_karma_activity_log(task_title, karma_value):
task = TaskList.objects.filter(title=task_title).first()
if task:
if karma_value > 0:
KarmaActivityLog.objects.create(
karma_log = KarmaActivityLog.objects.create(
task_id=task.id,
karma=karma_value,
user_id=user_id,
Expand All @@ -401,13 +401,17 @@ def create_karma_activity_log(task_title, karma_value):

dl = WebHookActions.SEPARATOR.value
discord_id = User.objects.get(id=user_id).discord_id
value = f"{task.hashtag}{dl}{karma_value}{dl}{discord_id}{dl}{task.id}"
value = f"{task.hashtag}{dl}{karma_value}{dl}{discord_id}{dl}{karma_log.id}"

DiscordWebhooks.general_updates(
WebHookCategory.KARMA_INFO.value,
WebHookActions.UPDATE.value,
value
)
else:
KarmaActivityLog.objects.filter(
task_id=task.id, user_id=user_id
).delete()
Wallet.objects.filter(user_id=user_id).update(
karma=F("karma") + karma_value,
updated_by_id=user_id
Expand Down

0 comments on commit c538f7b

Please sign in to comment.