Your tests timed out in JS Bird Watcher

Hi @iHiD . I was on Mixed-juices exercise when this occured. The iteration 1 shows failed. I submitted the iteration 2 using the online editor(i think with some improvements) and it worked. I copied the same iteration 1 solution and submitted as iteration 3 using an online editor and everything worked.

// @ts-check
//
// The line above enables type checking for this file. Various IDEs interpret
// the @ts-check directive. It will give you helpful autocompletion when
// implementing this exercise.
/**
 * Determines how long it takes to prepare a certain juice.
 *
 * @param {string} name
 * @returns {number} time in minutes
 */
export function timeToMixJuice(name) {
  //throw new Error('Please implement the timeToMixJuice function');
  switch (name) {
    case "Pure Strawberry Joy":
      return 0.5;
    case "Energizer":
    case "Green Garden":
      return 1.5;
    case "Tropical Island":
      return 3;
    case "All or Nothing":
      return 5;
    default:
      return 2.5;
  }
}
/**
 * Calculates the number of limes that need to be cut
 * to reach a certain supply.
 *
 * @param {number} wedgesNeeded
 * @param {string[]} limes
 * @returns {number} number of limes cut
 */
export function limesToCut(wedgesNeeded, limes) {
  //throw new Error("Please implement the limesToCut function");
  let need = wedgesNeeded;
  let i = 0;
  let limesNeeded = 0;
  while (need > 0 && i < limes.length) {
    if (limes[i] == "small") {
      need -= 6;
    } else if (limes[i] == "medium") {
      need -= 8;
    } else {
      need -= 10;
    }
    i += 1;
    limesNeeded += 1;
  }
  return limesNeeded;
}
/**
 * Determines which juices still need to be prepared after the end of the shift.
 *
 * @param {number} timeLeft
 * @param {string[]} orders
 * @returns {string[]} remaining orders after the time is up
 */
export function remainingOrders(timeLeft, orders) {
  //throw new Error("Please implement the remainingOrders function");
  //
  const remainingOrders = [];
  //let i = 0;
  // Pure Strawberry Joy = 0.5
  // Energizer = 1.5
  // GreenGarden = 1.5
  // Tropical Island = 3
  // All or Nothing = 5;
  // Others = 2.5
  //
  for (let i = 0; i < orders.length; i++) {
    let preparationTime = timeToMixJuice(orders[i]);
    if (timeLeft >= preparationTime || timeLeft > 0) {
      timeLeft -= preparationTime;
    } else {
      return orders.slice(i);
    }
  }
  return remainingOrders;
}

I have been using the online editor since then

Thank you for the update :slight_smile:

Yes, we understand the issue (IOPS limits on EC2 EBS drives - that are hit for JS due to the amount of per-test-run node modules) and have a solution. It’ll take a few more days of work to get it all into production.

No Worries. I am already loving using the online editor.

1 Like