I can't use the +
operator with resultado[0] + obj.nopersonas
, nopersonas
is an Integer.
fhinicio(blank:false, validator : { val, obj ->
def diff = groovy.time.TimeCategory.minus(obj.fhfinal, val)
def total = diff.hours*60 + diff.minutes
if (total < 15){
return "reserva.fhfinal.tiempo.min.label"
} else {
if (total > 60) {
return "reserva.fhfinal.tiempo.max.label"
} else {
def reserva = Reserva.createCriteria()
def resultado = reserva.list() {
or {
and {
ge('fhinicio', val)
le('fhinicio', obj.fhfinal)
}
and {
ge('fhfinal', val)
le('fhfinal', obj.fhfinal)
}
}
projections {
sum('nopersonas')
}
}
//this is not working
def aff = resultado[0] + obj.nopersonas
Cannot execute null+null. Stacktrace follows: Message: Cannot execute null+null