def _get_level(start_date, today, cycle_length):
    cycle_length_seconds = datetime.timedelta(days=cycle_length).total_seconds()
    current_phase = (today - start_date).total_seconds() / cycle_length_seconds
    # Standard sine starts at 0, with maximum of 1, minimum of -1, and period of 2pi
    # Our graph starts at 0, with maximum of 100, minimum of 0, and period of cycle_length
    # -0.5 radians shifts the graph 1/4 period to the right
    # +1 shifts the graph up 1 unit
    # *50 takes the max from 2 to 100
    return round(50 * (math.sin(math.pi * (0.5 - 2 * current_phase)) + 1))
dataset/ETHPy150Open jessamynsmith/eggtimer-server/periods/views.py/_get_level/swapped operands of `-`