Skip to content

Commit

Permalink
give kudos to not-my-activities (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
isaac-chung authored Apr 25, 2023
1 parent 21cd765 commit 40d07ef
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions give_kudos.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,19 @@ def locate_kudos_buttons_and_maybe_give_kudos(self, web_feed_entry_locator) -> i

web_feed = web_feed_entry_locator.nth(i)
p_count = web_feed.get_by_test_id("entry-header").count()
print(f"p_count: {p_count}")

# check if activity has multiple participants
if p_count > 1:
for j in range(p_count):
participant = web_feed.get_by_test_id("entry-header").nth(j)
# ignore own activities
if self.is_participant_me(participant):
if not self.is_participant_me(participant):
kudos_container = web_feed.get_by_test_id("kudos_comments_container").nth(j)
button = self.find_unfilled_kudos_button(kudos_container)
given_count += self.click_kudos_button(unfilled_kudos_container=button)
else:
# ignore own activities
if self.is_participant_me(web_feed):
if not self.is_participant_me(web_feed):
button = self.find_unfilled_kudos_button(web_feed)
given_count += self.click_kudos_button(unfilled_kudos_container=button)
print(f"Kudos given: {given_count}")
Expand All @@ -84,11 +83,8 @@ def is_participant_me(self, container) -> bool:
owner = self.own_profile_id
try:
h = container.get_by_test_id("owners-name").get_attribute('href')
print(h, end=' ')
hl = h.split("/athletes/")
print(hl, end=' ')
owner = hl[1]
print(owner, end=' ')
except:
print("Some issue with getting owners-name container.")
return owner == self.own_profile_id
Expand Down

0 comments on commit 40d07ef

Please sign in to comment.