Skip to content

Commit

Permalink
🐛 Fixed bug with not comparing value of enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Etesam913 committed Jul 19, 2022
1 parent 3330f4c commit fbc4b3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
8 changes: 4 additions & 4 deletions mephisto/scripts/local_db/remove_accepted_tip.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,21 @@ def main():

removal_response = Prompt.ask(
"\nDo you want to remove this tip? (Default: n)",
choices=[TipsRemovalType.REMOVE, TipsRemovalType.KEEP],
default=TipsRemovalType.KEEP,
choices=[tips_type.value for tips_type in TipsRemovalType],
default=TipsRemovalType.KEEP.value,
show_default=False,
).strip()
print("")

if removal_response == TipsRemovalType.REMOVE:
if removal_response == TipsRemovalType.REMOVE.value:
remove_tip_from_tips_file(
accepted_tips_copy, i, unit.get_task_run()
)
remove_tip_from_metadata(
accepted_tips, accepted_tips_copy, i, unit
)
print("Removed tip\n")
elif removal_response == TipsRemovalType.KEEP:
elif removal_response == TipsRemovalType.KEEP.value:
print("Did not remove tip\n")
print("There are no more tips to look at\n")

Expand Down
14 changes: 5 additions & 9 deletions mephisto/scripts/local_db/review_tips_for_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,13 @@ def main():

tip_response = Prompt.ask(
"\nDo you want to (a)ccept, (r)eject, or (s)kip this tip? (Default: s)",
choices=[
TipsReviewType.ACCEPTED,
TipsReviewType.REJECTED,
TipsReviewType.SKIP,
],
default=TipsReviewType.SKIP,
choices=[tips_type.value for tips_type in TipsReviewType],
default=TipsReviewType.SKIP.value,
show_default=False,
).strip()

print("")
if tip_response == TipsReviewType.ACCEPTED:
if tip_response == TipsReviewType.ACCEPTED.value:
# persists the tip in the db as it is accepted
accept_tip(tips, tips_copy, i, unit)
print("[green]Tip Accepted[/green]")
Expand Down Expand Up @@ -186,10 +182,10 @@ def main():
"\n[red]There was an error when paying out your bonus[/red]\n"
)

elif tip_response == TipsReviewType.REJECTED:
elif tip_response == TipsReviewType.REJECTED.value:
remove_tip_from_metadata(tips, tips_copy, i, unit)
print("Tip Rejected\n")
elif tip_response == TipsReviewType.SKIP:
elif tip_response == TipsReviewType.SKIP.value:
print("Tip Skipped\n")

print("There are no more tips to review\n")
Expand Down

0 comments on commit fbc4b3a

Please sign in to comment.