Everybody on a list Present?

(Ingo) #1

I’m still having a bit of trouble learning Groovy…

What I’d like is a version of Greetings Earthlings where it changes mode only when ALL the people on the people list are present.

I could do this in a heartbeat in Perl, a little slower in Java. But in Groovy… not quite yet.

How does one loop through a list of people, verifying that they’re all “present”?

(Im Brian) #2

@idean - This is an app that I’ve written to change state to Away when everyone is away -and change it to Home when at least one person is home. For your needs, you can copy the lion’s share of this and change the “anyoneIsHome” function to behave similar to “everyoneisAway”:

(Ingo) #3

Thanks, that looks perfect! Nice clean, easy to read code, too.