-
Notifications
You must be signed in to change notification settings - Fork 0
/
citizen.py
131 lines (114 loc) · 4.72 KB
/
citizen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
from usuario import usuario as user
class ciudadano(user):
def __init__(self, name, lastName, age, CUIL, phoneNumber, zone):
super().__init__(name, lastName, age, CUIL)
self.phoneNumber = phoneNumber
self.zone = zone
self.involvedEvents = []
self.citizenBan = False
self.friends=[]
self.solicitudes=[]
self.quien_me_rechazo = []
def __repr__(self):
return self.name + " " + self.lastName
@classmethod
def create_citizen(cls, name, lastName, age, CUIL, phoneNumber, zone):
from listadeCuidadanos import etlist
x = ciudadano(name, lastName, age, CUIL, phoneNumber, zone)
etlist.addCitizen(x)
@classmethod
def init_citizen_creation(cls, name, lastName, age, CUIL, phoneNumber, zone):
x = ciudadano(name, lastName, age, CUIL, phoneNumber, zone)
return x
def asistEvent(self, zone, num):
from listaDeEventos import eventos as ev
for people in ev.list[zone][num].listOfPeople:
if people == self:
return 'ested ya esta en este evento'
self.involvedEvents.append(ev.list[zone][num])
ev.list[zone][num].peopleQuantity += 1
ev.list[zone][num].listOfPeople.append(self)
print(ev.list[zone][num].listOfPeople)
print(ev.list[zone][num].peopleQuantity)
return f'usted se registro para el evento {ev.list[zone][num].titulo} correctamente'
def unAsistEvent(self, zone, num):
if len(self.involvedEvents) == 0:
return 'usted no esta en ningun evento'
from listaDeEventos import eventos as ev
del self.involvedEvents[num]
ev.list[zone][num].peopleQuantity -= 1
posicion = 0
for usted in ev.list[zone][num].listOfPeople:
if usted == self:
del ev.list[zone][num].listOfPeople[posicion]
else:
posicion += 1
print(ev.list[zone][num].peopleQuantity)
return f'usted se removio del evento {ev.list[zone][num].titulo} correctamente'
def seeEvents(self, zone):
from listaDeEventos import eventos as ev
num = 0
texto = ''
for events in ev.list[zone]:
texto += f'{num} | {events.titulo}:\n{events.description}\n'
num += 1
return texto
def seeInvolvedEvents(self):
texto = ''
num = 0
for events in self.involvedEvents:
texto += f'{num} | {events.titulo}\n'
num += 1
return texto
def enviar_solicitud(self, friend_cuil):
from listadeCuidadanos import etlist
Check_cuil=False
i=0
for a in etlist.citizenlist:
if int(a.CUIL) == int(friend_cuil):
Check_cuil=True
break
i+=1
if [friend_cuil] in self.friends:
return ("La persona ya se encuentra en tu lista de amigos")
if [self] in etlist.citizenlist[i].solicitudes:
return 'ya enviaste una solicitud de amistad a esta persona'
if Check_cuil==True:
etlist.citizenlist[i].solicitudes.append(self)
return f"Enviaste una solicitud a la persona con cuil {friend_cuil}."
else:
return "La persona no se encuentra el database del Anses."
def ver_solicitudes(self):
if len(self.solicitudes) == 0:
return 'no hay solicitudes de amistad'
print('tus solicitudes son:')
i = 0
for solicitudes in self.solicitudes:
print(f'{i}| nombre: {solicitudes.name} | cuil: {solicitudes.CUIL}\n')
i += 1
return ''
def aceptar_solicitud(self, idem):
idem = int(idem)
if len(self.solicitudes) == 0:
return 'no hay solicitudes de amistad'
elif idem - 1 > len(self.solicitudes):
return 'Ok, regresando al menu de amigos'
elif idem < 0:
return "ese es un numero negativo"
self.friends.append(self.solicitudes[idem])
self.solicitudes[idem].friends.append(self)
del self.solicitudes[idem]
return f'se agrego a {self.friends[-1].name} {self.friends[-1].lastName} (cuil: {self.friends[-1].CUIL}) correctamente'
def rechazar_solicitud(self, idem):
if len(self.solicitudes) == 0:
return 'no hay solicitudes de amistad'
elif idem - 1 > len(self.solicitudes):
return 'ese numero no es valido'
elif idem < 0:
return "ese es un numero negativo"
self.solicitudes[idem].quien_me_rechazo.append(self.CUIL)
del self.solicitudes[idem]
return 'La solicitud se elimino correctamente'
def change_zone(self, num):
self.zone = num
return num