func createBall1000(lball *ballon.All_ball, user *list.Element, base *db.Env) {
	lstmsg := createMessage1000()
	usr := user.Value.(*users.User)

	for i := 0; i < 1000; i++ {
		ball := new(ballon.Ball)

		ball.Id_ball = lball.Id_max
		lball.Id_max++
		ball.Edited = true
		ball.Title = "TEST" + strconv.Itoa(int(ball.Id_ball))
		ball.Messages = lstmsg
		ball.Coord = GetRandomCoord()
		ball.Itinerary = list.New()
		ball.Itinerary.PushBack(ball.Coord.Value.(*ballon.Checkpoint))
		ball.Followers = list.New()
		ball.Checkpoints = list.New()
		ball.Date = time.Now()
		ball.Possessed = nil
		ball.Followers = list.New()
		ball.Followers.PushFront(user)
		ball.Creator = user
		ball.Scoord = ball.Coord
		//	ball.InitCoord(ball.Coord.Value.(ballon.Checkpoint).Coord.Lon, ball.Coord.Value.(ballon.Checkpoint).Coord.Lat, int16(0), wd, true)
		eball := lball.Blist.PushBack(ball)
		usr.NbrBallSend++
		usr.Followed.PushBack(eball)
		lball.InsertBallon(ball, base)
	}

}
Beispiel #2
0
func createBall1000(lball *ballon.All_ball, user *list.Element, wd *owm.All_data) {
	usr := user.Value.(*users.User)

	for i := 0; i < 10; i++ {
		ball := new(ballon.Ball)

		ball.Id_ball = lball.Id_max
		lball.Id_max++
		ball.Edited = true
		ball.Title = "TEST" + strconv.Itoa(int(ball.Id_ball))
		ball.Messages = createMessage1000(ball.Title)
		ball.Coord = GetRandomCoord()
		ball.Itinerary = list.New()
		ball.Itinerary.PushBack(ball.Coord.Value.(*ballon.Checkpoint))
		ball.Followers = list.New()
		ball.Checkpoints = list.New()
		ball.Date = time.Now()
		ball.Possessed = nil
		ball.Followers = list.New()
		ball.Followers.PushFront(user)
		ball.Creator = user
		ball.Scoord = ball.Coord
		ball.InitCoord(ball.Coord.Value.(*ballon.Checkpoint).Coord.Lon, ball.Coord.Value.(*ballon.Checkpoint).Coord.Lat, int16(0), wd, true)
		ball.Stats = new(ballon.StatsBall)
		eball := lball.Blist.PushBack(ball)
		usr.Stats.NbrBallCreate++
		usr.Followed.PushBack(eball)
	}
	usr.Stats.NbrSend = usr.Stats.NbrBallCreate
	usr.Stats.NbrFollow = usr.Stats.NbrBallCreate
	usr.Stats.NbrMessage = usr.Stats.NbrBallCreate
}
Beispiel #3
0
func (Data *Data) Manage_newball(requete *list.Element, Tab_wd *owm.All_data) {
	ball := new(ballon.Ball)
	ball.Stats = new(ballon.StatsBall)
	rqt := requete.Value.(*protocol.Request)
	var newball protocol.New_ball
	var mess ballon.Message
	user := Data.User.Value.(*users.User)

	if user.NbrBallSend < 10 {
		newball = requete.Value.(*protocol.Request).Spec.(protocol.New_ball)
		ball.Id_ball = Data.Lst_ball.Id_max
		Data.Lst_ball.Id_max++
		ball.FlagC = true
		ball.Edited = true
		ball.Title = newball.Title
		ball.Messages = list.New()
		ball.Itinerary = list.New()
		ball.Followers = list.New()
		ball.Checkpoints = list.New()
		mess.Id = 0
		mess.Size = (int32)(len(newball.Message))
		mess.Content = newball.Message
		mess.Type = 1
		ball.Messages.PushFront(mess)
		ball.Date = time.Now()
		ball.Possessed = nil
		ball.Followers.PushFront(Data.User)
		ball.Creator = Data.User
		ball.InitCoord(rqt.Coord.Lon, rqt.Coord.Lat, int16(0), Tab_wd, true)
		eball := Data.Lst_ball.Blist.PushBack(ball)
		user := Data.User.Value.(*users.User)
		user.Followed.PushBack(eball)
		user.NbrBallSend++
		// Begin Stats
		user.Stats.NbrMessage++
		user.Stats.NbrBallCreate++
		user.Stats.NbrSend++
		user.Stats.NbrFollow++
		Data.Lst_users.GlobalStat.NbrBallCreate++
		Data.Lst_users.GlobalStat.NbrSend++
		Data.Lst_users.GlobalStat.NbrFollow++
		Data.Lst_users.GlobalStat.NbrMessage++
		ball.Stats.CreationDate = time.Now()
		ball.Stats.CoordCreated = new(ballon.Coordinate)
		ball.Stats.CoordCreated.Lon = rqt.Coord.Lon
		ball.Stats.CoordCreated.Lat = rqt.Coord.Lat
		ball.Stats.NbrFollow++
		// End Stats
		answer := Data.Manage_ack(rqt.Rtype, ball.Id_ball, int32(1))
		Data.Lst_asw.PushBack(answer)
	} else {
		answer := Data.Manage_ack(rqt.Rtype, 0, int32(0))
		Data.Lst_asw.PushBack(answer)
	}
}