Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed body parameters #932

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions backend/tasks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,17 +1071,14 @@ def delete_project_tasks(self, request, pk=None):
)
def get_users_recent_tasks(self, request):
try:
user_id = request.data.get("user_id")
task_type = request.data.get("task_type", "annotation")

user = request.user
task_type = request.query_params.get("task_type", "annotation")
project_id = request.query_params.get("Project ID", "")
task_id = request.query_params.get("Task ID", "")
updated_at = request.query_params.get("Updated at", "")
annotated_at = request.query_params.get("Annotated at", "")
created_at = request.query_params.get("Created at", "")

user = User.objects.get(pk=user_id)

annotations = Annotation.objects.filter(completed_by=user)
if task_type == "review":
annotations = annotations.filter(annotation_type=REVIEWER_ANNOTATION)
Expand All @@ -1093,22 +1090,37 @@ def get_users_recent_tasks(self, request):
annotations = annotations.filter(annotation_type=ANNOTATOR_ANNOTATION)

if project_id:
annotations = annotations.filter(task__project_id=project_id)
try:
annotations = annotations.filter(task__project_id=project_id)
except Exception as e:
pass

if task_id:
annotations = annotations.filter(task__id=task_id)
try:
annotations = annotations.filter(task__id=task_id)
except Exception as e:
pass

if updated_at:
date_obj = datetime.strptime(updated_at, "%d-%m-%Y")
annotations = annotations.filter(updated_at__date=date_obj.date())
try:
date_obj = datetime.strptime(updated_at, "%d-%m-%Y")
annotations = annotations.filter(updated_at__date=date_obj.date())
except Exception as e:
pass

if annotated_at:
date_obj = datetime.strptime(annotated_at, "%d-%m-%Y")
annotations = annotations.filter(annotated_at__date=date_obj.date())
try:
date_obj = datetime.strptime(annotated_at, "%d-%m-%Y")
annotations = annotations.filter(annotated_at__date=date_obj.date())
except Exception as e:
pass

if created_at:
date_obj = datetime.strptime(created_at, "%d-%m-%Y")
annotations = annotations.filter(created_at__date=date_obj.date())
try:
date_obj = datetime.strptime(created_at, "%d-%m-%Y")
annotations = annotations.filter(created_at__date=date_obj.date())
except Exception as e:
pass

annotations = annotations.order_by("-updated_at")
annotations = self.paginate_queryset(annotations)
Expand Down
Loading