Freelance-rates math issues

need help with the final formula. Can some one help me come up with the correct calculations.
Here is my try with python (my preferred language). My formula does not work. Need help with my math.

 def price_discounted(ratePerHour, numDays, discount):
       discounted_months = numDays//22
       reg_days = numDays%22
       discounted_rate = discounted_months * 22 * 8 * ratePerHour * discount
       reg_rate = reg_days * 8 * ratePerHour
       return round(discounted_rate + reg_rate)
  
  print(price_discounted(89, 230, 0.42))

I believe you are applying the discount incorrectly.

Yeah, My math is not so good.

This is my best try:

export function priceWithMonthlyDiscount(ratePerHour, numDays, discount) {
  full_months = Math.floor(numDays / 22);
  remaining_days = numDays % 22;
  full_months_discounted_rate = full_months * 22 * 8 * ratePerHour * (1 - discount);
  remaining_days_regular_rate = remaining_days * 8 * ratePerHour;
  total_cost = full_months_discounted_rate + remaining_days_regular_rate;
  return math.ceil(total_cost);
}

still not passing the test

What is the test output?