diff options
| author | dam <dam@gudinoff> | 2022-03-30 14:52:01 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2022-03-30 14:52:01 +0000 |
| commit | 8d4db7d2c92aa719da8ce218df9490283754d20b (patch) | |
| tree | 078be5ff293bec0877e9d17df934c9df86928351 /logic/database.gd | |
| parent | 84524e46a378d3694ebee9ab541feefe01866219 (diff) | |
| download | surgery-log-8d4db7d2c92aa719da8ce218df9490283754d20b.tar.zst surgery-log-8d4db7d2c92aa719da8ce218df9490283754d20b.zip | |
Fixed database fields being parsed as floats instead of integers by JSON.
Diffstat (limited to 'logic/database.gd')
| -rw-r--r-- | logic/database.gd | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/logic/database.gd b/logic/database.gd index a6f2747..5694dcc 100644 --- a/logic/database.gd +++ b/logic/database.gd @@ -158,6 +158,14 @@ func load_database(file_path: String = DATABASE_FILE_PATH): return db = parse_result.result["database"] + + # The JSON specification does not define integer or float types, but only a number type. + # Therefore, converting a Variant to JSON text will convert all numerical values to float types. + # Thus, we cast all integer values once we load them. + for it in db: + it.date_year = int(it.date_year) + it.date_month = int(it.date_month) + it.date_day = int(it.date_day) func save_database(file_path: String = DATABASE_FILE_PATH): |
