diff --git a/.github/workflows/collection-thread-updater.yml b/.github/workflows/collection-thread-updater.yml index 3cb9bd8..5f79acd 100644 --- a/.github/workflows/collection-thread-updater.yml +++ b/.github/workflows/collection-thread-updater.yml @@ -31,5 +31,5 @@ jobs: GIST_ID: ${{ secrets.GIST_ID }} GIST_TOKEN: ${{ secrets.GIST_TOKEN }} run: | - cd community-threads-grabber + cd community-threads python main.py diff --git a/.github/workflows/python-app.yml b/.github/workflows/titles-updater.yml similarity index 88% rename from .github/workflows/python-app.yml rename to .github/workflows/titles-updater.yml index 02db142..0220bc6 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/titles-updater.yml @@ -1,14 +1,9 @@ -name: r/developersIndia titles updater +name: r/developersIndia Titles Updater on: schedule: # At 19:30 on every 2nd day-of-week.” - cron: '30 19 * * */2' -# workflow_dispatch: -# push: -# branches: [ "main" ] -# pull_request: -# branches: [ "main" ] workflow_dispatch: permissions: diff --git a/README.md b/README.md index 4fe77c6..e664090 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ Used for changing the text below total members & live members count in a subredd Used for updating the Advent of Code leaderboard in the [post](https://www.reddit.com/r/developersIndia/comments/1889ar3/advent_of_code_rdevelopersindia_leaderboard_year/). -### [community-threads-grabber](https://github.com/developersIndia/deviras/tree/main/community-threads-grabber) +### [community-threads](https://github.com/developersIndia/deviras/tree/main/community-threads) -Used for grabbing the posts from [community threads collection](https://www.reddit.com/r/developersIndia/collection/958aef35-f9cb-414d-ab33-08bc639e47de/) and updating the [wiki](https://www.reddit.com/r/developersIndia/wiki/community-threads/). +Used for grabbing the posts from [community threads collection](https://www.reddit.com/r/developersIndia/collection/958aef35-f9cb-414d-ab33-08bc639e47de/) and adding it to the [wiki](https://www.reddit.com/r/developersIndia/wiki/community-threads/). ### [job_thread](https://github.com/developersIndia/deviras/blob/job_thread) diff --git a/aoc/main.py b/aoc/main.py index e66caa9..6037a9f 100644 --- a/aoc/main.py +++ b/aoc/main.py @@ -28,7 +28,9 @@ def format_leaderboard(data, num_players=100): # Include only the top players for i, member_data in enumerate(sorted_members[:num_players]): - leaderboard_stats += f"| {i + 1} | {member_data['name']} | {member_data['stars']} | {member_data['local_score']} |\n" + # check for non-zero local_score + if member_data['local_score'] > 0: + leaderboard_stats += f"| {i + 1} | {member_data['name']} | {member_data['stars']} | {member_data['local_score']} |\n" leaderboard_stats += f"\n[Advent of Code Leaderboard](https://adventofcode.com/2023/leaderboard/private/view/{aoc_leaderboard_code})\n" leaderboard_stats += f"\nUpdated every 24 hours" diff --git a/community-threads-grabber/__init__.py b/community-threads/__init__.py similarity index 100% rename from community-threads-grabber/__init__.py rename to community-threads/__init__.py diff --git a/community-threads-grabber/main.py b/community-threads/main.py similarity index 96% rename from community-threads-grabber/main.py rename to community-threads/main.py index 8b82537..b5cd711 100644 --- a/community-threads-grabber/main.py +++ b/community-threads/main.py @@ -61,14 +61,14 @@ def update_wiki(reddit, wikipage, posts): wiki_header = """# A collection of must read discussions started by community members""" content = wiki_header + "\n\n" - content += f"This collection contains a list of `{total_posts}` handpicked posts across `{total_years}` years.\n\n" + content += f"A handpicked collection of **{total_posts}** quality threads across {total_years} years.\n\n" for year in sorted(posts_by_year.keys(), reverse=True): content += f"## {year}\n\n" # Add the posts for this year for post in posts_by_year[year]: formatted_date = datetime.strptime(post['created_at'], '%Y-%m-%dT%H:%M:%S').strftime('%d-%m-%Y') - content += f"- `{formatted_date}` [{post['title']}]({post['url']})\n\n" + content += f"- `{formatted_date}` [`{post['title']}`]({post['url']})\n\n" # given a wiki link, update the wiki page with new markdown wikipage = reddit.subreddit(sub).wiki[wikipage]