-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from ElemarJR/fix_forecast
Fix forecast
- Loading branch information
Showing
6 changed files
with
58 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
backend/models/src/omni_models/syntactic/everhour/models/task.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
from typing import Optional, List | ||
from pydantic import BaseModel, field_validator | ||
from pydantic import BaseModel, field_validator, Field | ||
from datetime import datetime | ||
|
||
class Task(BaseModel): | ||
id: str | ||
name: str | ||
due_on: Optional[datetime] = None | ||
due_on: Optional[datetime] = Field(alias='dueOn', default=None) | ||
projects: List[str] | ||
|
||
@field_validator('due_on', mode='before') | ||
@classmethod | ||
def validate_due_on(cls, value): | ||
if isinstance(value, str): | ||
return datetime.strptime(value, "%Y-%m-%d") | ||
return value | ||
|
||
class Config: | ||
populate_by_name = True | ||
return value |