Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interfejs #5

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 93 additions & 29 deletions Modeli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def remove_child(self, child_node):
if child is not child_node]

def dfs_search(self, target):
#print(self.depth, self.value, target[self.depth])
if self is None:
return False

Expand All @@ -25,7 +24,6 @@ def dfs_search(self, target):
if child.dfs_search(target):
return True


class Destinacija:
def __init__(self, vreme, datum, mesto, polazakDolazak):
self._vreme = vreme
Expand Down Expand Up @@ -198,6 +196,16 @@ def logout(self):
self._kontakt = None
self._kartica = None


def kupiKartu(self, sediste, klasaLeta):
sediste.setDostupnost(False)
for x in klasaLeta.getSedista():
if x.getId() == sediste.getId():
klasaLeta.getSedista().remove(x)




KlasaEkonomska = KlasaLeta(0, [Sediste(0, 1), Sediste(1, 1)], 500) # 0 - ekonomska
KlasaBiznis = KlasaLeta(1, [Sediste(0, 1), Sediste(1, 1)], 1000) # 1 - biznis
KlasaPrva = KlasaLeta(2, [Sediste(0, 1), Sediste(1, 1)], 2500) # 2 - prva
Expand All @@ -207,39 +215,95 @@ def logout(self):

Let1 = Let(300, 150, [KlasaEkonomska, KlasaBiznis, KlasaPrva], Polazak, Dolazak)

"""
root = Node(-1, -1)
tr_node = Node("London", 0)
root.add_child(tr_node)
sledeci_node = Node("04.04.2024", 1)
tr_node.add_child(sledeci_node)
tr_node = sledeci_node
sledeci_node = Node("19:30", 2)
tr_node.add_child(sledeci_node)

tr_node = sledeci_node
sledeci_node = Node("Madrid", 3)
tr_node.add_child(sledeci_node)

tr_node = sledeci_node
sledeci_node = Node("04.04.2024", 4)
tr_node.add_child(sledeci_node)

tr_node = sledeci_node
sledeci_node = Node("22:00", 5)
tr_node.add_child(sledeci_node)
"""


korisnik = Korisnik()
aviokompanija = Aviokompanija()
#print(aviokompanija._letovi.children[0].value)

argumenti = ["London", "04.04.2024", "19:30", "Madrid", "04.04.2024", "22:00"]

aviokompanija = Aviokompanija()

aviokompanija.dodajLet(Let1)

#print(aviokompanija._letovi.children[0].value)
print(korisnik.dajArgumente(argumenti, aviokompanija))

a = input("uneti 'preference' da se ooguci podesavanje ili 'let' da bi se pretrazio let: ")
while a not in ['preference', 'let']:
a = input("uneti 'preference' da se ooguci podesavanje ili 'let' da bi se pretrazio let: ")
if a == "preference":
korisnik.setPreference(input("uneti preference: ").split())
a = input("uneti 'let' ukoliko zelite da nastavite kupovinu: ")


if a == "let":

argumenti = input("uneti redom mesto polaska, datum i vreme potom destinaciju, datim dolaska i vreme sletanja: ").split() #["London", "04.04.2024", "19:30", "Madrid", "04.04.2024", "22:00"]


while not korisnik.dajArgumente(argumenti, aviokompanija):
argumenti = input("NE POSTOJI LET POKUSAJ PONOVO: ").split() #["London", "04.04.2024", "19:30", "Madrid", "04.04.2024", "22:00"]


klasa = input("uneti 0 za ekonomsku, 1 za biznis, 2 za prvu klasu: ")
while not klasa in ["1", "2", "0"]:
klasa = input("uneti 0 za ekonomsku, 1 za biznis, 2 za prvu klasu: ")

sedista = []

while True:
if klasa == "0":
if not KlasaEkonomska.proveriZauzetost():
sedista = KlasaEkonomska.getSedista()
klasa = KlasaEkonomska
break
else:
sedista = []
print("klasa nije dostupna")
klasa = input("klasa nije dostupna, uneti 1 ili 2: ")
break

elif klasa == "1":
if not KlasaBiznis.proveriZauzetost():
sedista = KlasaBiznis.getSedista()
klasa = KlasaBiznis
break
else:
sedista = []
print("klasa nije dostupna")
klasa = input("klasa nije dostupna, uneti 0 ili 2: ")
break

elif klasa == "2":
if not KlasaPrva.proveriZauzetost():
sedista = KlasaPrva.getSedista()
klasa = KlasaPrva
break
else:
sedista = []
print("klasa nije dostupna")
klasa = input("klasa nije dostupna, uneti 0 ili 1: ")
break

print(sedista)

sediste = Sediste(int(input("uneti redni broj sedista: ")), 1)

while not sediste.getDostupnost():
sediste = Sediste(int(input("SEDISTE NIJE DOSTUPNO uneti redni broj sedista: ")), 1)

korisnik.kupiKartu(sediste, klasa)
print('CESTITAMO KUPILI STE KARTU')



korisnik.logout()






argumenti = ["London", "04.04.2024", "19:30", "Madrid", "04.04.2024", "22:00"]

aviokompanija.dodajLet(Let1)

#print(aviokompanija._letovi.children[0].value)
print(korisnik.dajArgumente(argumenti, aviokompanija))
Comment on lines +304 to +309
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deluje kao nešto što bi trebalo da bude u testu

5 changes: 4 additions & 1 deletion avio_karte.mdj
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"fontColor": "#3B0202",
"font": "Arial;13;0",
"left": 304,
"top": 206,
"width": 111.80078125,
"height": 53
"top": 188,
"width": 111.80078125,
"height": 83
Expand Down Expand Up @@ -3263,7 +3266,7 @@
},
"visible": false,
"font": "Arial;13;0",
"left": 392,
"left": 392
"top": 293,
"height": 13,
"alpha": 1.5707963267948966,
Expand Down
1 change: 1 addition & 0 deletions tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
if