Example code:

entity Line {
travel : Travel (inverse: travellines)
description : String
}

entity Travel {
description : String
travellines : Collection (inverse: travel)

static function Total(lines : Collection) : Num {
var sum = 0;
alert(“INSIDE SumTest”);
foreach(l : Line in lines) {}
alert(“INSIDE before return”);

	return sum;
}	

function Total() : Num {
	alert("before total test");
	var sum = Travel.Total(this.travellines);
	alert("after total test");
	return sum;
}

}

screen root() {
header(“outoforder”)
script {
// var t = Travel(description = “test”);
// var l = Line(description = “jaha”);
// t.travellines.add(l);

	var t = Travel.all().one();
	t.Total();
}

}

Alerts given:

1. before total test
2. INSIDE SumTest
3. after total test
4. INSIDE before return

The reason is using the “lines” parameter in Travel.Total either with foreach as in the example or use lets say log(lines.count())

Submitted by Terje Pedersen on 2 May 2011 at 10:20

On 2 May 2011 at 10:34 Terje Pedersen commented:

Just now I get around it by having the Travel.Total as a regular function and not as static inside Travel entity.


On 11 May 2011 at 16:23 Zef Hemel closed this issue.

On 11 May 2011 at 16:23 Zef Hemel commented:

Fixed in 0.4.4.


On 11 May 2011 at 16:23 Zef Hemel tagged 0.4.4

Log in to post comments