Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. from django.db import models
  2.  
  3. class GameInfo(models.Model):
  4.  
  5. game_id = models.CharField(max_length=30, primary_key=True)
  6. played_map = models.CharField(max_length=30)
  7.  
  8. round_number = models.IntegerField(max_lenght=2)
  9. t_scoure = models.IntegerField(max_lenght=2)
  10. ct_scoure = models.IntegerField(max_lenght=2)
  11.  
  12. winner = models.CharField(max_length=20)
  13. win_reason = models.CharField(max_length=30) #win_reason contains the winning team, so the winner might be unnecessary information
  14.  
  15. def __str__(self):
  16. return self.played_map + ' - ' + self.win_reason
  17.  
  18.  
  19. class PlayerData(models.Model):
  20.  
  21. game_id = models.ForeignKey(GameInfo, on_delete=models.CASCADE)
  22.  
  23. time = models.DecimalField(max_digits=6, decimal_places=3) #This time comes when on tick intervals (1/16 currently or 0.5s), so they do not match PlayerData time stamps, which log times when nades are thrown.
  24.  
  25. t1_pos = models.CharField(max_length=30)
  26. t2_pos = models.CharField(max_length=30)
  27. t3_pos = models.CharField(max_length=30)
  28. t4_pos = models.CharField(max_length=30)
  29. t5_pos = models.CharField(max_length=30)
  30.  
  31. t1_weapon = models.CharField(max_length=30)
  32. t2_weapon = models.CharField(max_length=30)
  33. t3_weapon = models.CharField(max_length=30)
  34. t4_weapon = models.CharField(max_length=30)
  35. t5_weapon = models.CharField(max_length=30)
  36.  
  37. ct1_pos = models.CharField(max_length=30)
  38. ct2_pos = models.CharField(max_length=30)
  39. ct3_pos = models.CharField(max_length=30)
  40. ct4_pos = models.CharField(max_length=30)
  41. ct5_pos = models.CharField(max_length=30)
  42.  
  43. ct1_weapon = models.CharField(max_length=30)
  44. ct2_weapon = models.CharField(max_length=30)
  45. ct3_weapon = models.CharField(max_length=30)
  46. ct4_weapon = models.CharField(max_length=30)
  47. ct5_weapon = models.CharField(max_length=30)
  48.  
  49. def __str__(self):
  50. return self.game_id
  51.  
  52.  
  53. class Nades(models.Model):
  54.  
  55. game_id = models.ForeignKey(GameInfo, on_delete=models.CASCADE)
  56. time = models.DecimalField(max_digits=6, decimal_places=3) #This time comes when nades explode not on a tick interval, so they do not match PlayerData time stamps
  57. nadetype = models.CharField(max_length=15)
  58.  
  59. def __str__(self):
  60. return self.game_id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement