Skip to content

Commit

Permalink
Fixes date serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
mrharpo committed Sep 8, 2023
1 parent bd25146 commit d7e8f61
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions chowda/fields.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dataclasses import dataclass
from datetime import datetime
from typing import Any

from starlette.datastructures import FormData
Expand Down Expand Up @@ -101,6 +102,19 @@ async def parse_obj(self, request: Request, obj: Any) -> Any:

return [run.dict() for run in new_runs or obj.metaflow_runs]

async def serialize_value(
self, request: Request, value: Any, action: RequestAction
) -> Any:
return [
{
**run,
'finished_at': run['finished_at'].isoformat()
if run.get('finished_at')
else None,
}
for run in value
]


@dataclass
class BatchPercentCompleted(BaseField):
Expand Down

0 comments on commit d7e8f61

Please sign in to comment.