Compare commits
No commits in common. "master" and "wip-share" have entirely different histories.
|
@ -16,7 +16,6 @@ class TimeSpent:
|
|||
name: str
|
||||
comment_id: str
|
||||
issue: str
|
||||
task: str
|
||||
repo: str
|
||||
issue: str
|
||||
date: str
|
||||
|
@ -55,10 +54,7 @@ class Gitea:
|
|||
else:
|
||||
logs[time.nick]["mins"] = int(time.mins)
|
||||
else:
|
||||
logs[time.nick] = {
|
||||
"hours": int(time.hours),
|
||||
"mins": int(time.mins),
|
||||
}
|
||||
logs[time.nick] = {"hours": int(time.hours), "mins": int(time.mins)}
|
||||
|
||||
for nick in logs:
|
||||
time = logs[nick]
|
||||
|
@ -68,7 +64,7 @@ class Gitea:
|
|||
|
||||
def write_csv(self):
|
||||
w = None
|
||||
print("writing to times.csv")
|
||||
print('writing to times.csv')
|
||||
with open("times.csv", "w+", encoding="utf-8") as f:
|
||||
for repo in self.times:
|
||||
for issue in self.times[repo]:
|
||||
|
@ -161,13 +157,14 @@ class Gitea:
|
|||
for issue in issues:
|
||||
times = []
|
||||
url = issue["html_url"]
|
||||
task = issue["title"]
|
||||
resp = requests.get(url)
|
||||
contents = resp.text
|
||||
soup = BeautifulSoup(contents, "html.parser")
|
||||
divs = soup.find_all("div", attrs={"class": "timeline-item event"})
|
||||
for div in divs:
|
||||
for a in div.find_all("a", attrs={"class": "author"}):
|
||||
for a in div.find_all(
|
||||
"a", attrs={"class": "author"}
|
||||
):
|
||||
if "added spent time" in a.parent.text:
|
||||
for s in a.parent.find_all(
|
||||
"span", attrs={"class": "time-since"}
|
||||
|
@ -181,24 +178,13 @@ class Gitea:
|
|||
.find_all("span")[0]
|
||||
.text
|
||||
)
|
||||
if "day" in time:
|
||||
continue
|
||||
if "h" in time:
|
||||
if "hours" in time:
|
||||
hours = int(time.split("hours")[0])
|
||||
elif "hour" in time:
|
||||
hours = int(time.split("hour")[0])
|
||||
else:
|
||||
hours = int(time.split("h")[0])
|
||||
else:
|
||||
hours = 0
|
||||
if "min" in time:
|
||||
splits = time.split("min")[0]
|
||||
if "hours" in time:
|
||||
mins = int(splits.split("hours")[1])
|
||||
elif "hour" in time:
|
||||
mins = int(splits.split("hour")[1])
|
||||
elif "h" in time:
|
||||
if "h" in splits:
|
||||
mins = int(splits.split("h")[1])
|
||||
else:
|
||||
mins = int(splits)
|
||||
|
@ -217,7 +203,6 @@ class Gitea:
|
|||
hours=hours,
|
||||
repo=repo,
|
||||
issue=url,
|
||||
task=task,
|
||||
url=f"{url}#{comment_id}",
|
||||
)
|
||||
)
|
||||
|
@ -225,9 +210,9 @@ class Gitea:
|
|||
repo_times.append(times)
|
||||
total_times[repo] = repo_times
|
||||
|
||||
|
||||
print(f"Found {num} log events in {self.org}")
|
||||
return total_times
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
g = Gitea(host="https://gitea.gna.org", org="gna")
|
||||
g = Gitea(host="https://gitea.hostea.org", org="Hostea")
|
||||
|
|
Loading…
Reference in New Issue