Source code for annofabapi.pydantic_models.project_account_statistics_history

"""


No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""

from __future__ import annotations

import json
import pprint
import re  # noqa: F401
from typing import Any, ClassVar, Dict, List, Set

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing_extensions import Self


[docs] class ProjectAccountStatisticsHistory(BaseModel): """ ProjectAccountStatisticsHistory """ var_date: str = Field(alias="date") tasks_completed: StrictInt = Field( description="教師付フェーズのタスクを提出した回数、または検査/受入フェーズのタスクを合格/差戻にした回数。 たとえば、あるタスクのタスク履歴が下表の状態だった場合、2020-04-01の`tasks_completed`は以下の通りになります。 * Alice: 1 * Bob: 1 * Chris: 2 <table> <tr> <th>担当者</th> <th>フェーズ</th> <th>作業内容</th> <th>完了日時</th> </tr> <tr> <td>Alice</td> <td>教師付</td> <td>提出する</td> <td>2020-04-01 09:00</td> </tr> <tr> <td>Chris</td> <td>受入</td> <td>差し戻す</td> <td>2020-04-01 10:00</td> </tr> <tr> <td>Bob</td> <td>教師付</td> <td>提出する</td> <td>2020-04-01 11:00</td> </tr> <tr> <td>Chris</td> <td>受入</td> <td>合格にする</td> <td>2020-04-01 12:00</td> </tr> </table> " ) tasks_rejected: StrictInt = Field( description="教師付フェーズを担当したタスクが差し戻された回数、または受入フェーズを担当したタスクが受入完了を取り消された回数。 たとえば、あるタスクのタスク履歴が下表の状態だった場合、2020-04-01の`tasks_rejected`は以下の通りになります。 * Alice: 1 * Bob: 1 * Chris: 1 <table> <tr> <th>担当者</th> <th>フェーズ</th> <th>作業内容</th> <th>完了日時</th> </tr> <tr> <td>Alice</td> <td>教師付</td> <td>提出する</td> <td>2020-04-01 09:00</td> </tr> <tr> <td>Chris</td> <td>受入</td> <td>差し戻す</td> <td>2020-04-01 10:00</td> </tr> <tr> <td>Bob</td> <td>教師付</td> <td>提出する</td> <td>2020-04-01 11:00</td> </tr> <tr> <td>Chris</td> <td>受入</td> <td>差し戻す</td> <td>2020-04-01 12:00</td> </tr> <tr> <td>Bob</td> <td>教師付</td> <td>提出する</td> <td>2020-04-01 13:00</td> </tr> <tr> <td>Chris</td> <td>受入</td> <td>合格にする</td> <td>2020-04-01 14:00</td> </tr> <tr> <td>Dave</td> <td>受入</td> <td>受入完了状態を取り消して、再度合格にする</td> <td>2020-04-01 15:00</td> </tr> </table> " ) worktime: StrictStr = Field(description="作業時間(ISO 8601 duration)") __properties: ClassVar[List[str]] = ["date", "tasks_completed", "tasks_rejected", "worktime"] model_config = ConfigDict( populate_by_name=True, validate_assignment=True, protected_namespaces=(), )
[docs] def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True))
[docs] def to_json(self) -> str: """Returns the JSON representation of the model using alias""" # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return json.dumps(self.to_dict())
[docs] @classmethod def from_json(cls, json_str: str) -> Self | None: """Create an instance of ProjectAccountStatisticsHistory from a JSON string""" return cls.from_dict(json.loads(json_str))
[docs] def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's `self.model_dump(by_alias=True)`: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. """ excluded_fields: Set[str] = set([]) _dict = self.model_dump( by_alias=True, exclude=excluded_fields, exclude_none=True, ) return _dict
[docs] @classmethod def from_dict(cls, obj: Dict[str, Any] | None) -> Self | None: """Create an instance of ProjectAccountStatisticsHistory from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) _obj = cls.model_validate( { "date": obj.get("date"), "tasks_completed": obj.get("tasks_completed"), "tasks_rejected": obj.get("tasks_rejected"), "worktime": obj.get("worktime"), } ) return _obj