Skip to content

Commit c1baecf

Browse files
committed
bug fix
1 parent 846ebeb commit c1baecf

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11

22
# Changelog - xerparser
33

4+
## 0.9.7 - 2023-05-24
5+
6+
* Bug fixes.
7+
48
## 0.9.6 - 2023-05-14
59

610
### Added

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "xerparser"
3-
version = "0.9.6"
3+
version = "0.9.7"
44
description = "Parse a P6 .xer file to a Python object."
55
authors = ["Jesse <code@seqmanagement.com>"]
66
license = "GPL-3.0-only"

xerparser/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.9.6"
1+
__version__ = "0.9.7"
22

33
from xerparser.src.errors import find_xer_errors, CorruptXerFile
44
from xerparser.src.parser import parser, file_reader

xerparser/schemas/task.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
datetime_or_none,
2020
date_format,
2121
float_or_none,
22+
float_or_zero,
2223
int_or_none,
2324
str_or_none,
2425
)
@@ -96,7 +97,6 @@ def is_task(self) -> bool:
9697
return self is self.TT_Task
9798

9899
def __init__(self, calendar: CALENDAR, wbs: PROJWBS, **data) -> None:
99-
100100
self.uid: str = data["task_id"]
101101

102102
# Foreign keys
@@ -164,10 +164,11 @@ def __init__(self, calendar: CALENDAR, wbs: PROJWBS, **data) -> None:
164164
self.cstr_type2: str | None = str_or_none(data["cstr_type2"])
165165

166166
# Unit quantities
167-
self.target_work_qty: float = float(data["target_work_qty"])
168-
self.act_work_qty: float = float(data["act_work_qty"])
169-
self.target_equip_qty: float = float(data["target_equip_qty"])
170-
self.act_equip_qty: float = float(data["act_equip_qty"])
167+
# Have encoutered XER files where these qty's are stored as empty strings.
168+
self.target_work_qty: float = float_or_zero(data["target_work_qty"])
169+
self.act_work_qty: float = float_or_zero(data["act_work_qty"])
170+
self.target_equip_qty: float = float_or_zero(data["target_equip_qty"])
171+
self.act_equip_qty: float = float_or_zero(data["act_equip_qty"])
171172

172173
self.activity_codes: dict[ACTVTYPE, ACTVCODE] = {}
173174
self.user_defined_fields: dict[UDFTYPE, Any] = {}

0 commit comments

Comments
 (0)