diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fd7b56..30139ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # CHANGELOG + +## 0.3.36 +- [x] update: Reftime handling works if reftime is malformed + ## 0.3.35 - [x] add: validations for the input file for conversation tagging diff --git a/pyproject.toml b/pyproject.toml index 810a948..c0e7ffa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "skit-labels" -version = "0.3.35" +version = "0.3.36" description = "Command line tool for interacting with labelled datasets at skit.ai." authors = [] license = "MIT" diff --git a/skit_labels/db.py b/skit_labels/db.py index c2eb0cd..a82d282 100644 --- a/skit_labels/db.py +++ b/skit_labels/db.py @@ -26,6 +26,15 @@ ) +def update_reftime(reftime, tz): + try: + reftime = to_datetime(reftime) + return reftime.astimezone(tz).isoformat() + except Exception as e: + print("Couldn't convert thr timezone for Reftime: " + str(reftime)) + return reftime + + def build_task( d: Dict, task_type: str, data_id: Optional[str] = None, tz=pytz.UTC ) -> Task: @@ -39,8 +48,7 @@ def build_task( # Since the reftime from db is in UTC, we convert it to our timezone. This # is needed as saying 12 pm means different things in different timezones # and can't be translated without doing something stupid. - task.reftime = to_datetime(task.reftime) - task.reftime = task.reftime.astimezone(tz).isoformat() + task.reftime = update_reftime(task.reftime, tz) elif task_type == "simulated_call": task = SimulatedCallTask.from_dict(d) elif task_type == "audio_segment":