Currently, the completion time fields in a HowLongToBeatEntry are ints instead of floats. This is because of the following lines in JSONResultParser.parse_json_element:
# Add a few times elements as help for the user
current_entry.main_story = round(input_game_element["comp_main"] // 3600, 1)
current_entry.main_extra = round(input_game_element["comp_plus"] // 3600, 1)
current_entry.completionist = round(input_game_element["comp_100"] // 3600, 1)
current_entry.all_styles = round(input_game_element["comp_all"] // 3600, 1)
The problem is that // is used instead of /, which results in integer division instead of float division. Because of the round function here, which doesn't actually do anything at the moment, I'm assuming this is a bug and not a feature.
To fix it, you can change these lines to:
# Add a few times elements as help for the user
current_entry.main_story = round(input_game_element["comp_main"] / 3600, 2)
current_entry.main_extra = round(input_game_element["comp_plus"] / 3600, 2)
current_entry.completionist = round(input_game_element["comp_100"] / 3600, 2)
current_entry.all_styles = round(input_game_element["comp_all"] / 3600, 2)
(I also recommend using two digits of rounding precision instead of one — alternatively, you could forgo rounding altogether and let the user choose the rounding precision)
Currently, the completion time fields in a
HowLongToBeatEntryareints instead offloats. This is because of the following lines inJSONResultParser.parse_json_element:The problem is that
//is used instead of/, which results in integer division instead of float division. Because of theroundfunction here, which doesn't actually do anything at the moment, I'm assuming this is a bug and not a feature.To fix it, you can change these lines to:
(I also recommend using two digits of rounding precision instead of one — alternatively, you could forgo rounding altogether and let the user choose the rounding precision)