possibly only output unknowns if it makes a difference

This commit is contained in:
Tomáš Mládek 2019-10-23 16:25:02 +02:00
parent f55571168a
commit ab40226f5f

View file

@ -160,7 +160,7 @@ class DudleBot:
elif response == PlanResponse.UNKNOWN:
results[idx] = (results[idx][0], results[idx][1] + 1)
sorted_days = list(zip(days, results))
sorted_days = list(zip(days, results)) # "Sorted" by date
sorted_days.sort(key=lambda dwr: dwr[1][1], reverse=True) # First sort by unknowns
sorted_days.sort(key=lambda dwr: dwr[1][0], reverse=True) # Then sort by positive answers
@ -184,6 +184,11 @@ class DudleBot:
day, result = day_with_result
yes, unknown = result
result_fmt = str(yes) + (f" + {unknown}?" if unknown > 0 else "")
# result_fmt = str(yes)
# if unknown > 0:
# same_results = [result for _, result in best_days if result[0] == yes]
# if any(same_unknown != unknown for _, same_unknown in same_results):
# result_fmt += f" + {unknown}?"
response += f"{idx + 1}. {day.strftime('%A %-d/%-m')} ({result_fmt})\n"
return response
else: