Skip to content

Commit 57b3d10

Browse files
authored
Merge pull request #13 from veghdev/viewclone
Fixed: search actual date in view and clone stats
2 parents 68b6d21 + 0745eb0 commit 57b3d10

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "write-githubstat"
77
packages = [
88
{ include = "writegithubstat", from = "src" },
99
]
10-
version = "0.1.3"
10+
version = "0.1.4"
1111
readme = "README.md"
1212
description = "write-githubstat makes it easy to collect, filter and save github statistics to csv files."
1313
license = "Apache 2.0"

Diff for: src/writegithubstat/githubstat.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ def _get_actual_stat(
162162
self, data: Dict[str, Any], name: str
163163
) -> Dict[str, Union[int, str]]:
164164
try:
165-
stat = data[name][-1]
166-
if not stat["timestamp"].startswith(self._date):
167-
raise ValueError(
168-
f"The views data for the date {self._date} is not available."
169-
)
170-
return stat
165+
for stat in data[name]:
166+
if stat["timestamp"].startswith(self._date):
167+
return stat
168+
raise ValueError(
169+
f"The views data for the date {self._date} is not available."
170+
)
171171
except (KeyError, IndexError, ValueError):
172172
return {"count": 0, "uniques": 0}
173173

0 commit comments

Comments
 (0)