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