[solved] I keep getting NaN even if I repeat the same formula


#1

I do not know what I am doing wrong, I am using a Meteor Method to get a total for a "shopping cart"
But I keep getting an Nan

saveCart : function(cart){
  check(cart, Match.ObjectIncluding({
    userKey: String,
    items: [Match.ObjectIncluding({
      codigo: String,
      quantity:Number
    })]
  }));

  var products = ProductList.find({
    codigo: {$in: _.pluck(cart.items, 'codigo')}
  }).fetch();

  var codigoMap = _.object(_.pluck(products, 'codigo'), products);

  cart.updated_at = new Date();
  cart.total = 0;


   cart.Wtotal =0;
cart.Sustotal=0;
      var counter = 0;
      _.each(cart.items, function(item){
        item.precio = codigoMap[item.codigo].precio;
        item.hrs = codigoMap[item.codigo].hrs;
        item.watts = codigoMap[item.codigo].watts;
        item.quantity = Math.max(0, item.quantity);

        item.lineTotal = item.precio * item.quantity;
        cart.total+=item.lineTotal;


        item.Wline =item.watts * item.quantity * 50;
 

           cart.Wtotal+=item.Wline;
    
    //I am getting the Nan from this function
            item.Susline =item.quantity * ((50000/item.hrs)-1);
            cart.Sustotal+=item.Wline;
    
            counter++;
          });
      cart.itemCount = counter;
      Carts.update({userKey : cart.userKey}, cart, {upsert : true});
      return cart;
    },

I have tried substituting for other values and functions such as item.precio and I keep getting the same result

complete project https://github.com/orozcorp/sp