mirror of
https://github.com/TurTaskProject/TurTaskWeb.git
synced 2025-12-18 21:44:07 +01:00
Update docstring style
This commit is contained in:
parent
4a1a42859b
commit
c122812b32
@ -8,30 +8,35 @@ from django.utils import timezone
|
|||||||
class Tag(models.Model):
|
class Tag(models.Model):
|
||||||
"""
|
"""
|
||||||
Represents a tag that can be associated with tasks.
|
Represents a tag that can be associated with tasks.
|
||||||
Fields:
|
|
||||||
- name: The unique name of the tag.
|
:param name: The unique name of the tag.
|
||||||
"""
|
"""
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
|
|
||||||
|
|
||||||
class Task(models.Model):
|
class Task(models.Model):
|
||||||
"""
|
"""
|
||||||
Represents a task, such as Habit, Daily, Todo, or Reward.
|
Represents a task, such as Habit, Daily, Todo, or Reward.
|
||||||
Fields:
|
|
||||||
- type: The type of the tasks
|
:param type: The type of the tasks
|
||||||
- title: Title of the task.
|
:param title: Title of the task.
|
||||||
- notes: Optional additional notes for the task.
|
:param notes: Optional additional notes for the task.
|
||||||
- tags: Associated tags for the task.
|
:param tags: Associated tags for the task.
|
||||||
- completed: A boolean field indicating whether the task is completed.
|
:param completed: A boolean field indicating whether the task is completed.
|
||||||
- exp: The experience values user will get from the task.
|
:param exp: The experience values user will get from the task.
|
||||||
- priority: The priority of the task (range: 0.1 to 2).
|
:param priority: The priority of the task (1, 2, .., 4), using Eisenhower Matrix Idea.
|
||||||
- difficulty: The difficulty of the task (range: 1 to 5).
|
:param importance: The importance of the task (range: 1 to 5)
|
||||||
- attribute: The attribute linked to the task
|
:param difficulty: The difficulty of the task (range: 1 to 5).
|
||||||
- user: The user who owns the task.
|
:param attribute: The attribute linked to the task
|
||||||
- challenge: Associated challenge (optional).
|
:param user: The user who owns the task.
|
||||||
- reminders: A Many-to-Many relationship with Reminder.
|
:param challenge: Associated challenge (optional).
|
||||||
- fromSystem: A boolean field indicating if the task is from System.
|
:param reminders: A Many-to-Many relationship with Reminder.
|
||||||
- creation_date: Creation date of the task.
|
:param fromSystem: A boolean field indicating if the task is from System.
|
||||||
- last_update: Last updated date of the task.
|
:param creation_date: Creation date of the task.
|
||||||
|
:param last_update: Last updated date of the task.
|
||||||
|
:param: google_calendar_id: Google Calendar Event ID of the task.
|
||||||
|
:param start_event: Start event of the task.
|
||||||
|
:param end_event: End event(Due Date) of the task.
|
||||||
"""
|
"""
|
||||||
TASK_TYPES = [
|
TASK_TYPES = [
|
||||||
('daily', 'Daily'),
|
('daily', 'Daily'),
|
||||||
@ -83,6 +88,11 @@ class Task(models.Model):
|
|||||||
end_event = models.DateTimeField(null=True)
|
end_event = models.DateTimeField(null=True)
|
||||||
|
|
||||||
def calculate_eisenhower_matrix_category(self):
|
def calculate_eisenhower_matrix_category(self):
|
||||||
|
"""
|
||||||
|
Classify the task into one of the four categories in the Eisenhower Matrix.
|
||||||
|
|
||||||
|
:return: The category of the task (1, 2, 3, or 4).
|
||||||
|
"""
|
||||||
if self.end_event:
|
if self.end_event:
|
||||||
time_until_due = (self.end_event - datetime.now(timezone.utc)).days
|
time_until_due = (self.end_event - datetime.now(timezone.utc)).days
|
||||||
else:
|
else:
|
||||||
@ -113,9 +123,9 @@ class Task(models.Model):
|
|||||||
class Subtask(models.Model):
|
class Subtask(models.Model):
|
||||||
"""
|
"""
|
||||||
Represents a subtask associated with a task.
|
Represents a subtask associated with a task.
|
||||||
- description: Description of the subtask.
|
:param description: Description of the subtask.
|
||||||
- completed: A boolean field indicating whether the subtask is completed.
|
:param completed: A boolean field indicating whether the subtask is completed.
|
||||||
- parent_task: The parent task of the subtask.
|
:param parent_task: The parent task of the subtask.
|
||||||
"""
|
"""
|
||||||
description = models.TextField()
|
description = models.TextField()
|
||||||
completed = models.BooleanField(default=False)
|
completed = models.BooleanField(default=False)
|
||||||
@ -125,10 +135,10 @@ class Subtask(models.Model):
|
|||||||
class UserNotification(models.Model):
|
class UserNotification(models.Model):
|
||||||
"""
|
"""
|
||||||
Represents a user notification.
|
Represents a user notification.
|
||||||
Fields:
|
|
||||||
- type: The type of the notification (e.g., 'NEW_CHAT_MESSAGE').
|
:param type: The type of the notification (e.g., 'NEW_CHAT_MESSAGE').
|
||||||
- data: JSON data associated with the notification.
|
:param data: JSON data associated with the notification.
|
||||||
- seen: A boolean field indicating whether the notification has been seen.
|
:param seen: A boolean field indicating whether the notification has been seen.
|
||||||
"""
|
"""
|
||||||
NOTIFICATION_TYPES = (
|
NOTIFICATION_TYPES = (
|
||||||
('LEVEL_UP', 'Level Up'),
|
('LEVEL_UP', 'Level Up'),
|
||||||
@ -160,12 +170,12 @@ class UserNotification(models.Model):
|
|||||||
class Transaction(models.Model):
|
class Transaction(models.Model):
|
||||||
"""
|
"""
|
||||||
Represents a transaction involving currencies in the system.
|
Represents a transaction involving currencies in the system.
|
||||||
Fields:
|
|
||||||
- currency: The type of currency used in the transaction
|
:param currency: The type of currency used in the transaction
|
||||||
- transactionType: The type of the transaction
|
:param transactionType: The type of the transaction
|
||||||
- description: Additional text.
|
:param description: Additional text.
|
||||||
- amount: The transaction amount.
|
:param amount: The transaction amount.
|
||||||
- user: The user involved in the transaction.
|
:param user: The user involved in the transaction.
|
||||||
"""
|
"""
|
||||||
CURRENCIES = (('gold', 'Gold'),)
|
CURRENCIES = (('gold', 'Gold'),)
|
||||||
TRANSACTION_TYPES = (
|
TRANSACTION_TYPES = (
|
||||||
|
|||||||
@ -2,7 +2,6 @@ from rest_framework import serializers
|
|||||||
from django.utils.dateparse import parse_datetime
|
from django.utils.dateparse import parse_datetime
|
||||||
from .models import Task
|
from .models import Task
|
||||||
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
class GoogleCalendarEventSerializer(serializers.Serializer):
|
class GoogleCalendarEventSerializer(serializers.Serializer):
|
||||||
summary = serializers.CharField()
|
summary = serializers.CharField()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user