mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-17 02:45:08 +00:00
article page
This commit is contained in:
@ -595,8 +595,8 @@ class StartAssessmentAPIView(viewsets.ModelViewSet):
|
||||
article_id = self.request.GET.get('article_id')
|
||||
# if referral_code:
|
||||
article = Article.objects.filter(id=article_id, is_deleted=False).prefetch_related(
|
||||
'article_cards', 'article_survey', 'article_survey__options'
|
||||
).order_by('-created_at')
|
||||
'article_survey'
|
||||
)
|
||||
return article
|
||||
def list(self, request, *args, **kwargs):
|
||||
"""Params
|
||||
|
@ -306,8 +306,9 @@ class StartAssessmentSerializer(serializers.ModelSerializer):
|
||||
"""current page"""
|
||||
context_data = self.context.get('user')
|
||||
data = JuniorArticle.objects.filter(junior__auth=context_data, article=obj).last()
|
||||
total_count = obj.article_survey.all().count()
|
||||
if data:
|
||||
return data.current_que_page
|
||||
return data.current_que_page if data.current_que_page <= total_count else data.current_que_page - 1
|
||||
return NUMBER['zero']
|
||||
class Meta(object):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user