예제 #1
0
파일: home.go 프로젝트: nymoral/gothere
func drawFull(w http.ResponseWriter, db *sql.DB, pk int) {
	var context models.HomeContext
	context.Games = database.GetGames(db)
	lastGame := models.LastGame(context.Games)
	context.Users = database.GetUsers(db, pk)
	context.GamesNr = len(context.Games)
	context.UsersNr = len(context.Users)
	context.Guesses = database.GetGuesses(db, pk, context.GamesNr, context.UsersNr, lastGame)
	templates.Render(w, "home", context)
}
예제 #2
0
파일: home.go 프로젝트: nymoral/gothere
func drawSmall(w http.ResponseWriter, db *sql.DB, pk int) {
	var context models.HomeContext
	context.Users = database.GetUsers(db, pk)
	context.UsersNr = len(context.Users)

	allGames := database.GetGames(db)
	lastGame := models.LastGame(allGames)
	s, e := getSlice(len(allGames), lastGame)
	context.Games = allGames[s:e]
	context.Guesses = database.GetSmall(db, pk, context.UsersNr, s, e-s, lastGame)
	templates.Render(w, "small", context)
}