Poll.evalVote (param, usr)
check if a vote is ok. if true, save modified vote

  • Parameter Object:
    the req.data object coming in from the action
  • Parameter Object:
    the voting user object
  • Returns
    Object containing the properties - error (boolean): true if error occured, false otherwise - message (String): an error or a confirmation message - url (String): the URL string of the poll
Sourcecode in Poll/objectFunctions.js:
1:   function evalVote(param, usr) {
2:      this.checkVote(usr, req.data.memberlevel);
3:   	if (!param.choice)
4:   	   throw new Exception("noVote");
5:   	var c = this.get(param.choice);
6:   	var v = usr ? this.votes.get(usr.name) : null;
7:   	if (v) {
8:   		v.choice = c;
9:   		v.modifytime = new Date();
10:  	} else
11:  		this.votes.add(new Vote(c, usr));
12:  	return new Message("Vote");
13:  }