make responders private | add accessors
This commit is contained in:
parent
2468ac225c
commit
50f85ff2e2
@ -313,7 +313,7 @@ object Polls {
|
||||
def respondToQuestion(pollId: String, questionID: Int, responseID: Int, responder: Responder, polls: Polls) {
|
||||
polls.polls.get(pollId) match {
|
||||
case Some(p) => {
|
||||
if (!p._responders.exists(_ == responder)) {
|
||||
if (!p.getResponders().exists(_ == responder)) {
|
||||
p.addResponder(responder)
|
||||
p.respondToQuestion(questionID, responseID, responder)
|
||||
}
|
||||
@ -458,11 +458,7 @@ class Poll(val id: String, val questions: Array[Question], val numRespondents: I
|
||||
private var _stopped: Boolean = false
|
||||
private var _showResult: Boolean = false
|
||||
private var _numResponders: Int = 0
|
||||
var _responders = new ArrayBuffer[Responder]()
|
||||
|
||||
def addResponder(responder: Responder) {
|
||||
_responders += (responder)
|
||||
}
|
||||
private var _responders = new ArrayBuffer[Responder]()
|
||||
|
||||
def showingResult() { _showResult = true }
|
||||
def showResult(): Boolean = { _showResult }
|
||||
@ -477,6 +473,9 @@ class Poll(val id: String, val questions: Array[Question], val numRespondents: I
|
||||
_stopped = false
|
||||
}
|
||||
|
||||
def addResponder(responder: Responder) { _responders += (responder) }
|
||||
def getResponders(): ArrayBuffer[Responder] = { return _responders }
|
||||
|
||||
def hasResponses(): Boolean = {
|
||||
questions.foreach(q => {
|
||||
if (q.hasResponders) return true
|
||||
|
Loading…
Reference in New Issue
Block a user