article page

This commit is contained in:
jain
2023-08-29 18:56:51 +05:30
parent 8b0a5d9a8e
commit 3ad29e677d
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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):
"""