Problem with Date() constructor inside each block


(Luiz Zamboni) #1

Strange error when execute follow script

valid_concurrents = _source.concurrents.findAll{ concurrent_ids.contains(it.seller_id) };

def with_data = [];
valid_concurrents.each{
	d = [:];
	d["id"] =  it.id;
	d["seller_id"] =  it.seller_ida;
	d["name"] =  it.name;
	d["diff_price"] =  _source.new_price - it.new_price;
 	d["diff_percent"] =  (_source.new_price / it.new_price * 100) - 100; 
 	if(_source.new_price == it.new_price){
 		d["status"] = "equal";
 	}else if(_source.new_price > it.new_price){
 		d["status"] = "winning";
 	}else if(_source.new_price < it.new_price){
 		d["status"] = "losing";
 	};
	d["crawled_at_seconds"] = ((new Date().time - new Date(it["updated_at"].value).time)/1000).toInteger();
	with_data << d;
};

return with_data;

Could not find matching constructor for: java.util.Date([C)]

Why the "((new Date().time - new Date(it["updated_at"].value).time)/1000).toInteger();" not works inside each block outsite it works...


(system) #2