 					endedSetup++
 				else if gameState == 1
 					endedRunning++
-				else if gameState ==2
+				else if gameState == 2
 					endedProper++
 			# Team statistics
 			game.iterate 'game', 'teams', (team) !->

	return 0

# Client call to update databases
exports.client_gatherHistory = ->
	Timer.cancel 'gatheringTimeout', {}
	Timer.cancel 'updateCompletion', {}
	Db.shared.set 'doneCount', 0
	Db.shared.set 'lastDoneCount', 0
	Db.shared.set 'updating', 'true'
	log '[gatherHistory()] Starting to request'
	Db.backend.iterate 'pluginInfo' , (group) !->
		Db.backend.set 'pluginInfo', group.key(), 'upToDate', 'false'
		if Db.backend.peek('pluginInfo', group.key(), 'active') is 'true'
			log '  Requesting from: '+group.key()
			Http.post 
				url: 'https://happening.im/x/' + group.key()
				data: '64foNwpEfn3LQrTQC2q5NijPqG92Nv2xYi65gFz6uTJjPJS2stN7MbyNygtvKvNS'
				name: 'historyResult'
	log '[gatherHistory()] Done sending requests'
	Timer.set Config.gatheringTimeout, 'gatheringTimeout', {}
	Timer.set Config.updateCompletionDelay, 'updateCompletion', {}
	return 0

# Client call for updating statistics
exports.client_updateStatistics = ->

exports.updateCompletion = (args) ->
	done = true
	doneCount = 0
	Db.backend.iterate 'pluginInfoCopy', (group) !->
		if Db.backend.peek('pluginInfoCopy', group.key(), 'active') isnt 'false'
			if Db.backend.peek('pluginInfoCopy', group.key(), 'upToDate') is 'false'
				done = false
			else
				doneCount++
