mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-17 02:45:08 +00:00
added notification for getting points after reading article
This commit is contained in:
@ -47,7 +47,7 @@ from account.utils import custom_response, custom_error_response
|
||||
from guardian.utils import upload_image_to_alibaba
|
||||
from .utils import update_positions_based_on_points
|
||||
from notifications.utils import send_notification
|
||||
from notifications.constants import REMOVE_JUNIOR
|
||||
from notifications.constants import REMOVE_JUNIOR, ARTICLE_REWARD_POINTS
|
||||
from web_admin.models import Article, ArticleSurvey, SurveyOption, ArticleCard
|
||||
from web_admin.serializers.article_serializer import (ArticleSerializer, ArticleListSerializer,
|
||||
StartAssessmentSerializer)
|
||||
@ -666,6 +666,8 @@ class CompleteArticleAPIView(views.APIView):
|
||||
is_answer_correct=True).aggregate(
|
||||
total_earn_points=Sum('earn_points'))['total_earn_points']
|
||||
data = {"total_earn_points":total_earn_points}
|
||||
send_notification.delay(ARTICLE_REWARD_POINTS, None, None,
|
||||
request.user.id, {'points': total_earn_points})
|
||||
return custom_response(SUCCESS_CODE['3042'], data, response_status=status.HTTP_200_OK)
|
||||
except Exception as e:
|
||||
return custom_error_response(str(e), response_status=status.HTTP_400_BAD_REQUEST)
|
||||
|
Reference in New Issue
Block a user