Skip to content

Commit

Permalink
Fix headers in markdown to reflect when its limited to date range
Browse files Browse the repository at this point in the history
Signed-off-by: Zack Koppert <[email protected]>
  • Loading branch information
zkoppert committed Aug 24, 2024
1 parent 490a611 commit 03df74b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
| ------------------ | ------------------- | ------------------ |
| 1 | 143 | 0% |
| Username | Contribution Count | New Contributor | Commits |
| Username | All Time Contribution Count | New Contributor | Commits between 2021-01-01 and 2023-10-10 |
| --------- | ------------------ | --------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| @zkoppert | 143 | False | [super-linter/super-linter](https://github.com/super-linter/super-linter/commits?author=zkoppert&since=2021-01-01&until=2023-10-10) |
```
Expand All @@ -171,7 +171,7 @@ jobs:
| ------------------ | ------------------- | ------------------ |
| 1 | 1913 | 0% |
| Username | Contribution Count | New Contributor | Sponsor URL | Commits |
| Username | All Time Contribution Count | New Contributor | Sponsor URL | Commits between 2021-09-01 and 2023-09-30 |
| --------- | ------------------ | --------------- | ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| @zkoppert | 1913 | False | [Sponsor Link](https://github.com/sponsors/zkoppert) | [super-linter/super-linter](https://github.com/super-linter/super-linter/commits?author=zkoppert&since=2021-09-01&until=2023-09-30) |
```
Expand Down
7 changes: 5 additions & 2 deletions markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,15 @@ def get_contributor_table(
total_contributions (int): The total number of contributions made by all of the contributors.
"""
columns = ["Username", "Contribution Count"]
columns = ["Username", "All Time Contribution Count"]
if start_date and end_date:
columns += ["New Contributor"]
if sponsor_info == "true":
columns += ["Sponsor URL"]
columns += ["Commits"]
if start_date and end_date:
columns += [f"Commits between {start_date} and {end_date}"]
else:
columns += ["All Commits"]

headers = "| " + " | ".join(columns) + " |\n"
headers += "| " + " | ".join(["---"] * len(columns)) + " |\n"
Expand Down
6 changes: 3 additions & 3 deletions test_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_write_to_markdown(self, mock_file):
"| Total Contributors | Total Contributions | % New Contributors |\n| --- | --- | --- |\n| 2 | 300 | 50.0% |\n\n"
)
mock_file().write.assert_any_call(
"| Username | Contribution Count | New Contributor | Commits |\n"
"| Username | All Time Contribution Count | New Contributor | Commits between 2023-01-01 and 2023-01-02 |\n"
"| --- | --- | --- | --- |\n"
"| @user1 | 100 | False | commit url |\n"
"| @user2 | 200 | True | commit url2 |\n"
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_write_to_markdown_with_sponsors(self, mock_file):
"| Total Contributors | Total Contributions | % New Contributors |\n| --- | --- | --- |\n| 2 | 300 | 50.0% |\n\n"
)
mock_file().write.assert_any_call(
"| Username | Contribution Count | New Contributor | Sponsor URL | Commits |\n"
"| Username | All Time Contribution Count | New Contributor | Sponsor URL | Commits between 2023-01-01 and 2023-01-02 |\n"
"| --- | --- | --- | --- | --- |\n"
"| @user1 | 100 | False | [Sponsor Link](sponsor_url_1) | commit url |\n"
"| @user2 | 200 | True | not sponsorable | commit url2 |\n"
Expand Down Expand Up @@ -168,7 +168,7 @@ def test_write_to_markdown_without_link_to_profile(self, mock_file):
"| Total Contributors | Total Contributions | % New Contributors |\n| --- | --- | --- |\n| 2 | 300 | 50.0% |\n\n"
)
mock_file().write.assert_any_call(
"| Username | Contribution Count | New Contributor | Commits |\n"
"| Username | All Time Contribution Count | New Contributor | Commits between 2023-01-01 and 2023-01-02 |\n"
"| --- | --- | --- | --- |\n"
"| user1 | 100 | False | commit url |\n"
"| user2 | 200 | True | commit url2 |\n"
Expand Down

0 comments on commit 03df74b

Please sign in to comment.