<commit_before>from google.appengine.ext import ndb
import json
from constants import *


class Visitor(ndb.Model):
	ip = ndb.StringProperty()
	added_on = ndb.DateTimeProperty(auto_now_add=True)



class event(ndb.Model):
	name = ndb.StringProperty(required=True)
	type = ndb.StringProperty(required=True)
	date = ndb.DateTimeProperty()
	location = ndb.GeoPtProperty()
	members = ndb.KeyProperty(repeated=True , kind = 'account')
	created_by = ndb.KeyProperty(kind = 'account')
	formatted_location = ndb.StringProperty(required=True)
	from_time = ndb.StringProperty()
	end_time = ndb.StringProperty()
	description = ndb.StringProperty()
	min_attend = ndb.StringProperty()
	max_attend = ndb.StringProperty()


	def custom_to_dict(self):
		"""for event"""
		return {
			'id': self.key.id(),
			'members': [key.id() for key in self.members],
			'created_by' : self.created_by.id(),
			'location':{'lat': self.location.lat, 'lon': self.location.lon},
			'formatted_location':self.formatted_location,
			'name':self.name,
			'type':self.type,
			'date':str(self.date.isoformat())[:str(self.date.isoformat()).find('T')],
			'from_time':self.from_time,
			'end_time':self.end_time,
			'description':self.description,
			'min_attend' : self.min_attend,
			'max_attend' : self.max_attend
		}


class account(ndb.Model):
	fullname = ndb.StringProperty(required=True)
	facebook_id = ndb.StringProperty()
	google_id = ndb.StringProperty()
	photo = ndb.BlobProperty(required=True)
	photo_url = ndb.StringProperty(required=True)
	email = ndb.StringProperty(required=True)
	password = ndb.StringProperty()
	events = ndb.KeyProperty(repeated=True , kind = 'event')
	notifications_token = ndb.StringProperty()
	#idan 4.6
	createdCount =  ndb.StringProperty()

	def custom_to_dict(self):
		"""for user"""

		user_key = ndb.Key('account', int(self.key.id()))
		query_result = event.query(event.members == user_key).fetch()

		return {
			'id': self.key.id(),
			'events': [key.id() for key in self.events],
			'fullname' : self.fullname,
			'email' : self.email,
			'photo' : self.photo,
			'photo_url' : self.photo_url,
			#add for user profile
			'createdCount' : self.createdCount,
			'eventsEntries' : [p.custom_to_dict() for p in query_result] # i want full entry
		}

<commit_msg>return in full name the facebook name (temp)<commit_after>from google.appengine.ext import ndb
import json
from constants import *


class Visitor(ndb.Model):
	ip = ndb.StringProperty()
	added_on = ndb.DateTimeProperty(auto_now_add=True)



class event(ndb.Model):
	name = ndb.StringProperty(required=True)
	type = ndb.StringProperty(required=True)
	date = ndb.DateTimeProperty()
	location = ndb.GeoPtProperty()
	members = ndb.KeyProperty(repeated=True , kind = 'account')
	created_by = ndb.KeyProperty(kind = 'account')
	formatted_location = ndb.StringProperty(required=True)
	from_time = ndb.StringProperty()
	end_time = ndb.StringProperty()
	description = ndb.StringProperty()
	min_attend = ndb.StringProperty()
	max_attend = ndb.StringProperty()


	def custom_to_dict(self):
		"""for event"""
		return {
			'id': self.key.id(),
			'members': [key.id() for key in self.members],
			'created_by' : self.created_by.id(),
			'location':{'lat': self.location.lat, 'lon': self.location.lon},
			'formatted_location':self.formatted_location,
			'name':self.name,
			'type':self.type,
			'date':str(self.date.isoformat())[:str(self.date.isoformat()).find('T')],
			'from_time':self.from_time,
			'end_time':self.end_time,
			'description':self.description,
			'min_attend' : self.min_attend,
			'max_attend' : self.max_attend
		}


class account(ndb.Model):
	fullname = ndb.StringProperty(required=True)
	facebook_id = ndb.StringProperty()
	google_id = ndb.StringProperty()
	photo = ndb.BlobProperty(required=True)
	photo_url = ndb.StringProperty(required=True)
	email = ndb.StringProperty(required=True)
	password = ndb.StringProperty()
	events = ndb.KeyProperty(repeated=True , kind = 'event')
	notifications_token = ndb.StringProperty()
	#idan 4.6
	createdCount =  ndb.StringProperty()

	def custom_to_dict(self):
		"""for user"""

		user_key = ndb.Key('account', int(self.key.id()))
		query_result = event.query(event.members == user_key).fetch()

		return {
			'id': self.key.id(),
			'events': [key.id() for key in self.events],
			'fullname' : self.facebook_id, # temporary. (The facebook id is the only name we have right now)
			'email' : self.email,
			'photo' : self.photo,
			'photo_url' : self.photo_url,
			#add for user profile
			'createdCount' : self.createdCount,
			'eventsEntries' : [p.custom_to_dict() for p in query_result] # i want full entry
		}


{'fraction_non_alphanumeric': 0.14846784635304272, 'fraction_numerical': 0.0008631851532153647, 'mean_word_length': 4.896946564885496, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '877923', 'n_tokens_mistral': 1759, 'n_tokens_neox': 1634, 'n_words': 305}