Skip to content

Commit 20df10f

Browse files
authored
Merge pull request #3 from pmbrull/feature/daily-stars
Daily stars instead of weekly
2 parents d00e789 + 90abbb9 commit 20df10f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

openstats/components.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ def stars_component(self):
3434
Prepare the graph to show the stars evolution
3535
and the differences
3636
"""
37-
df = self.data.stars_data().reset_index(level=0)
37+
df = self.data.stars_data()
3838

3939
if df is not None and not df.empty:
4040
current = int(df.iloc[-1].get("stars"))
41-
last_week = int(df.iloc[-2].get("stars"))
42-
last_month = int(df.iloc[-4].get("stars"))
41+
last_week = int(df.iloc[-7].get("stars"))
42+
last_month = int(df.iloc[-30].get("stars"))
4343

4444
else:
4545
st.write("Error fetching Star data")

openstats/data.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def stars_data(self) -> Optional[DataFrame]:
5959
)
6060

6161
df["date"] = pd.to_datetime(df["date"])
62-
df = df.resample("W", on="date")[["stars"]].sum()
62+
# This resample groups by week. Let's keep grouping by day.
63+
# df = df.resample("W", on="date")[["stars"]].sum()
6364
df["stars"] = df["stars"].cumsum()
6465

6566
return df

0 commit comments

Comments
 (0)