mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-26 06:09:41 +00:00
modified task description field, modified check answer api and create task api
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.2 on 2023-09-08 10:41
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('guardian', '0021_guardian_is_deleted'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='juniortask',
|
||||
name='task_description',
|
||||
field=models.CharField(blank=True, max_length=500, null=True),
|
||||
),
|
||||
]
|
@ -97,7 +97,7 @@ class JuniorTask(models.Model):
|
||||
"""task details"""
|
||||
task_name = models.CharField(max_length=100)
|
||||
"""task description"""
|
||||
task_description = models.CharField(max_length=500)
|
||||
task_description = models.CharField(max_length=500, null=True, blank=True)
|
||||
"""points of the task"""
|
||||
points = models.IntegerField(default=TASK_POINTS)
|
||||
"""last date of the task"""
|
||||
|
@ -208,14 +208,13 @@ class CreateTaskAPIView(viewsets.ModelViewSet):
|
||||
junior_data = Junior.objects.filter(id__in=junior_ids,
|
||||
guardian_code__contains=[guardian.guardian_code]
|
||||
).select_related('auth')
|
||||
if junior_data:
|
||||
for junior in junior_data:
|
||||
index = junior.guardian_code.index(guardian.guardian_code)
|
||||
status_index = junior.guardian_code_status[index]
|
||||
if status_index == str(NUMBER['three']):
|
||||
return custom_error_response(ERROR_CODE['2078'], response_status=status.HTTP_400_BAD_REQUEST)
|
||||
else:
|
||||
if not junior_data:
|
||||
return custom_error_response(ERROR_CODE['2047'], response_status=status.HTTP_400_BAD_REQUEST)
|
||||
for junior in junior_data:
|
||||
index = junior.guardian_code.index(guardian.guardian_code)
|
||||
status_index = junior.guardian_code_status[index]
|
||||
if status_index == str(NUMBER['three']):
|
||||
return custom_error_response(ERROR_CODE['2078'], response_status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
# use TaskSerializer serializer
|
||||
serializer = TaskSerializer(context={"guardian": guardian, "image": image_data,
|
||||
|
@ -643,7 +643,7 @@ class CheckAnswerAPIView(viewsets.ModelViewSet):
|
||||
answer_id = self.request.GET.get('answer_id')
|
||||
current_page = self.request.GET.get('current_page')
|
||||
queryset = self.get_queryset()
|
||||
submit_ans = SurveyOption.objects.filter(id=answer_id).last()
|
||||
submit_ans = SurveyOption.objects.filter(id=answer_id, is_answer=True).last()
|
||||
junior_article_points = JuniorArticlePoints.objects.filter(junior__auth=self.request.user,
|
||||
question=queryset)
|
||||
if submit_ans:
|
||||
|
@ -4,7 +4,7 @@ web_admin auth views file
|
||||
# django imports
|
||||
from rest_framework.viewsets import GenericViewSet
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework import status
|
||||
from rest_framework import status
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
# local imports
|
||||
|
Reference in New Issue
Block a user