Skip to content

Commit 6fc0d9b

Browse files
committed
Close #17 - Time is now float
1 parent e59f5a8 commit 6fc0d9b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

howlongtobeatpy/howlongtobeatpy/JSONResultParser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ def parse_json_element(self, input_game_element):
6464
# Add full JSON content to the entry
6565
current_entry.json_content = input_game_element
6666
# Add a few times elements as help for the user
67-
current_entry.main_story = round(input_game_element["comp_main"] // 3600, 1)
68-
current_entry.main_extra = round(input_game_element["comp_plus"] // 3600, 1)
69-
current_entry.completionist = round(input_game_element["comp_100"] // 3600, 1)
70-
current_entry.all_styles = round(input_game_element["comp_all"] // 3600, 1)
67+
current_entry.main_story = round(input_game_element["comp_main"] / 3600, 2)
68+
current_entry.main_extra = round(input_game_element["comp_plus"] / 3600, 2)
69+
current_entry.completionist = round(input_game_element["comp_100"] / 3600, 2)
70+
current_entry.all_styles = round(input_game_element["comp_all"] / 3600, 2)
7171
# Compute Similarity
7272
game_name_similarity = self.similar(self.game_name, current_entry.game_name,
7373
self.game_name_numbers, self.similarity_case_sensitive)

howlongtobeatpy/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
long_description = fh.read()
55

66
setup(name='howlongtobeatpy',
7-
version='1.0.1',
7+
version='1.0.2',
88
packages=find_packages(exclude=['tests']),
99
description='A Python API for How Long to Beat',
1010
long_description=long_description,

howlongtobeatpy/tests/test_normal_request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ def getMaxSimilarityElement(list_of_results):
1515
def getSimpleNumber(time_string):
1616
if time_string is None:
1717
return 0
18+
if isinstance(time_string, float):
19+
return time_string
1820
if isinstance(time_string, int):
1921
return time_string
20-
if not time_string.isdigit():
21-
return int(time_string.strip().replace("½", " "))
2222
return int(time_string)
2323

2424
def test_simple_similarity_value(self):

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ sonar.organization=scrappycocco-github
22
sonar.projectKey=ScrappyCocco_HowLongToBeat-PythonAPI
33

44
sonar.projectName=HowLongToBeat-PythonAPI
5-
sonar.projectVersion=1.0.1
5+
sonar.projectVersion=1.0.2
66
sonar.python.version=3.6
77

88
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.

0 commit comments

Comments
 (0)