From fcd2f0bf789f8a5be37f85a71a4f43318887de81 Mon Sep 17 00:00:00 2001 From: Alejandro Lopez Date: Sun, 14 Oct 2018 23:49:22 -0600 Subject: [PATCH 1/2] Replaced today string with the current date --- git_stalk/stalk.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/git_stalk/stalk.py b/git_stalk/stalk.py index 6d64985..2a894b0 100644 --- a/git_stalk/stalk.py +++ b/git_stalk/stalk.py @@ -105,6 +105,11 @@ def date_time_validate(date_text): except ValueError: raise ValueError("Incorrect data format, should be YYYY-MM-DD") + +def get_today_date(): + return (str(datetime.datetime.now().strftime("%Y-%m-%d"))) + + def get_contributions(user, latest, org=None): """ Traverses the latest array, @@ -112,7 +117,7 @@ def get_contributions(user, latest, org=None): if org argument is present only the repos which belong to the org is added to the table and prints the table. """ - print("Contributions Today: ") + print("Contributions Today: ({})".format(get_today_date())) if latest: table = PrettyTable(["Type", "Repository", "Time", "Details"]) for event in latest: @@ -138,8 +143,8 @@ def get_contributions(user, latest, org=None): get_details(event) ]) print(table) - print("{} have made {} public contribution(s) today.\n".format( - user, str(len(latest)))) + print("{} have made {} public contribution(s) {}.\n".format( + user, str(len(latest)), get_today_date())) def get_other_activity(user, other): @@ -148,7 +153,7 @@ def get_other_activity(user, other): creates a table and prints the table. """ - print("Other Activity today: ") + print("Other Activity today (): ".format(get_today_date())) if other: other_table = PrettyTable(["Type", "Repository", "Time", "Details"]) for event in other: @@ -158,7 +163,7 @@ def get_other_activity(user, other): get_details(event), ]) print(other_table) - print("{} have done {} other public activit(y/ies) today.\n".format(user, str(len(other)))) + print("{} have done {} other public activit(y/ies) {}.\n".format(user, str(len(other)), get_today_date())) def display_stars(user, stars): @@ -167,13 +172,13 @@ def display_stars(user, stars): creates a table and prints the table. """ - print("Starred today: ") + print("Starred today ({}): ".format(get_today_date())) if stars: star_table = PrettyTable(["Repository", "Language", "Time"]) for starred_repo in stars: star_table.add_row([starred_repo["repo"]["name"], get_language_for_repo(starred_repo["repo"]["url"]),get_local_time(starred_repo["created_at"])]) print(star_table) - print("{} have starred {} repo(s) today.".format(user, str(len(stars)))) + print("{} have starred {} repo(s) {}.".format(user, str(len(stars)), get_today_date())) def fill_todays_data(user, today, events, latest, stars, other): From 8e1c3a7d0be340bfea32d9c22c07ca6a6708f35e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20L=C3=B3pez?= Date: Wed, 17 Oct 2018 16:39:52 -0600 Subject: [PATCH 2/2] Update stalk.py --- git_stalk/stalk.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git_stalk/stalk.py b/git_stalk/stalk.py index 2a894b0..2bbf0b7 100644 --- a/git_stalk/stalk.py +++ b/git_stalk/stalk.py @@ -117,7 +117,7 @@ def get_contributions(user, latest, org=None): if org argument is present only the repos which belong to the org is added to the table and prints the table. """ - print("Contributions Today: ({})".format(get_today_date())) + print("Contributions {} :".format(get_today_date())) if latest: table = PrettyTable(["Type", "Repository", "Time", "Details"]) for event in latest: @@ -153,7 +153,7 @@ def get_other_activity(user, other): creates a table and prints the table. """ - print("Other Activity today (): ".format(get_today_date())) + print("Other Activity {}: ".format(get_today_date())) if other: other_table = PrettyTable(["Type", "Repository", "Time", "Details"]) for event in other: @@ -172,7 +172,7 @@ def display_stars(user, stars): creates a table and prints the table. """ - print("Starred today ({}): ".format(get_today_date())) + print("Starred {}: ".format(get_today_date())) if stars: star_table = PrettyTable(["Repository", "Language", "Time"]) for starred_repo in stars: