<commit_before>from django.db import models
from django.contrib.auth.models import User
from sublist.models import Sublist

'''
A player can exist on many teams and in many divisions both as a division rep and/or as a sub, and these
are not mutually exlusive
Player -> Team     : 0 .. *
Player -> Division : 0 .. *
Player -> Sub      : 
'''
class Player(models.Model):
	user         = models.OneToOneField(
	    User,
            on_delete=models.CASCADE,
            primary_key=True,
	    )
	phone_number = models.IntegerField(blank=True, null=True)


	def __str__(self):
# chose not to use this because fName and lName are not required on users yet.
#		name = self.user.first_name + ' ' + self.user.last_name
		return self.user.username

	#function to return all of the sublists related to a player instance
	def related_sublists(self):
            return Sublist.objects.filter(session__subs__player=self)

'''
                sessions = None
		sublists = None
		subs = self.sub_set.all()
		for sub in subs:
			sessions += sub.sessions
		for session in sessions:
			sublists += session.sublist
		return sublists
		if self.sub:
			sub = self.sub
			related_sessions = sub.session_set.all()
			for session in related_sessoins:
				sublists += session.sublist
			return sublists
'''
	
'''
Subs are a "tuple-ish" construction tying a player and a date together to indicate what date they are
willing to sub in a Division. 

Note: Eventually, I'd like players to be able to select a particular date that they could sub in a
Division, OR, put themselves down for an entire session, in which case, we will likely need a model for
session containing the dates of a particular session within a division. There are typically 3 sessions
in a division per year, but the sessions don't necessarily correspond across divisions.
'''
class Sub(models.Model):
	player = models.ForeignKey(Player)
	date   = models.DateTimeField('sub date')

	def __str__(self):
		availability = self.player.user.username + ' is available ' + str(self.date)
		return availability

	def _get_sessions(self):
		return self.session_set.all()
	sessions = property(_get_sessions) 


'''<commit_msg>removed excess comments from main/models.py<commit_after>from django.db import models
from django.contrib.auth.models import User
from sublist.models import Sublist

'''
A player can exist on many teams and in many divisions both as a division rep and/or as a sub, and these
are not mutually exlusive
Player -> Team     : 0 .. *
Player -> Division : 0 .. *
Player -> Sub      : 
'''
class Player(models.Model):
	user         = models.OneToOneField(
	    User,
            on_delete=models.CASCADE,
            primary_key=True,
	    )
	phone_number = models.IntegerField(blank=True, null=True)


	def __str__(self):
# chose not to use this because fName and lName are not required on users yet.
#		name = self.user.first_name + ' ' + self.user.last_name
		return self.user.username

	#function to return all of the sublists related to a player instance
	def related_sublists(self):
            return Sublist.objects.filter(session__subs__player=self)

	
'''
Subs are a "tuple-ish" construction tying a player and a date together to indicate what date they are
willing to sub in a Division. 

Note: Eventually, I'd like players to be able to select a particular date that they could sub in a
Division, OR, put themselves down for an entire session, in which case, we will likely need a model for
session containing the dates of a particular session within a division. There are typically 3 sessions
in a division per year, but the sessions don't necessarily correspond across divisions.
'''
class Sub(models.Model):
	player = models.ForeignKey(Player)
	date   = models.DateTimeField('sub date')

	def __str__(self):
		availability = self.player.user.username + ' is available ' + str(self.date)
		return availability

	def _get_sessions(self):
		return self.session_set.all()
	sessions = property(_get_sessions) 


'''
{'fraction_non_alphanumeric': 0.07941693892937925, 'fraction_numerical': 0.0015079165619502387, 'mean_word_length': 3.6064814814814814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3178753', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1127, 'n_words': 452}