80 lines
1.7 KiB
Python
80 lines
1.7 KiB
Python
"""File for Category class."""
|
|
|
|
|
|
class Category:
|
|
"""Stores a category's information. Used just to pass sql query information around."""
|
|
|
|
def __init__(self, category_info: tuple) -> None:
|
|
"""
|
|
Default constructor for Category class. Populates class from sql query results. Tuple order is important.
|
|
|
|
Args:
|
|
name (str): Category's name
|
|
"""
|
|
self._id: int = category_info[0]
|
|
self._name: str = category_info[1]
|
|
self._group_id: int = category_info[2]
|
|
self._is_ascending: bool = category_info[3]
|
|
self._is_time_record: bool = category_info[4]
|
|
self._is_validated: bool = category_info[5]
|
|
|
|
@property
|
|
def id(self) -> int:
|
|
"""
|
|
Getter for id.
|
|
|
|
Returns:
|
|
int: id
|
|
"""
|
|
return self._id
|
|
|
|
@property
|
|
def name(self) -> str:
|
|
"""
|
|
Getter for name.
|
|
|
|
Returns:
|
|
str: name
|
|
"""
|
|
return self._name
|
|
|
|
@property
|
|
def group_id(self) -> int:
|
|
"""
|
|
Getter for group id.
|
|
|
|
Returns:
|
|
int: group id
|
|
"""
|
|
return self._group_id
|
|
|
|
@property
|
|
def is_ascending(self) -> bool:
|
|
"""
|
|
Getter for is ascending.
|
|
|
|
Returns:
|
|
bool: is ascending
|
|
"""
|
|
return self._is_ascending
|
|
|
|
@property
|
|
def is_time_record(self) -> bool:
|
|
"""
|
|
Getter for is time record.
|
|
|
|
Returns:
|
|
bool: is time record
|
|
"""
|
|
return self._is_time_record
|
|
|
|
@property
|
|
def is_validated(self) -> bool:
|
|
"""
|
|
Getter for is validated.
|
|
|
|
Returns:
|
|
bool: is validated
|
|
"""
|
|
return self._is_validated
|