Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kompiangg committed Dec 16, 2021
2 parents 84acefd + 03222e2 commit 708cdbc
Show file tree
Hide file tree
Showing 46 changed files with 130 additions and 349 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1 align="center">Stellar Coffee</h1>
<img src="./docs/StellarCoffee.png">
<img src="./docs/StellarCoffee2.png">
<h2 align="center">Our Data Structure Course's Final Project</h2>
</br>

Expand Down Expand Up @@ -55,4 +55,6 @@ It's actually consist of 2 Core Part, [FrontEnd](https://github.com/kompiangg/St
| SQLAlchemy | Provides Database Interface Abstraction for Python |

# Full Team
[Fuyuna](https://github.com/nmluci) [Pangpang](https://github.com/kompiangg)
| [Fuyuna](https://github.com/nmluci) | [Pangpang](https://github.com/kompiangg) | [Ngakan](https://github.com/NgakanWidyasprana) | [Diah](https://github.com/diahpramesti) | [James Fang](https://github.com/jamesfangyauw) | [Audy](https://github.com/diahpramesti) |
--------------------------------------|------------------------------------------|------------------------------------------------|-----------------------------------------|------------------------------------------------|------------------------------------------
| Project Lead, Back-End, DBA | Full-Stack DevOps | Full-Stack | Front-End | Front-End | Front-End
2 changes: 1 addition & 1 deletion app/order/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
def todaySpecialty():
try:
todaySpecials = generateTodaySpecialty()
return make_response(SuccessResponse(data=todaySpecials).toDict())
return make_response(SuccessResponse(data=[todaySpecials]).toDict())
except Exception as e:
return make_response(FailedResponse(errorMessage=str(e)).toDict(), 500)

Expand Down
48 changes: 44 additions & 4 deletions app/order/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from typing import Dict, List, Mapping

from dataclasses import dataclass
from datetime import datetime

from sqlalchemy.util.langhelpers import monkeypatch_proxied_specials
from app.baseModel import db

class Orders(db.Model):
Expand Down Expand Up @@ -69,6 +73,44 @@ def delete(self):

def update(self):
db.session.commit()

class Graph:
def __init__(self, vertices: List[List[int]], alias: List):
self.alias = alias
self.days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
self.V = vertices
self.graph = [[0 for column in range(vertices)] for row in range(vertices)]

def isSafe(self, v, colour, c):
for i in range(self.V):
if self.graph[v][i] == 1 and colour[i] == c:
return False
return True

def graphColourUtil(self, m, colour, v):
if v == self.V:
return True

for c in range(1, m + 1):
if self.isSafe(v, colour, c) == True:
colour[v] = c
if self.graphColourUtil(m, colour, v + 1) == True:
return True
colour[v] = 0

def graphColouring(self, m: int) -> Dict:
mappedColour = dict(list())
colour = [0] * self.V
if self.graphColourUtil(m, colour, 0) == None:
return False

for idx, c in enumerate(colour):
if not mappedColour.get(c):
mappedColour[c] = [self.alias[idx]]
else:
mappedColour[c].append(self.alias[idx])

return mappedColour

@dataclass
class EventData:
Expand Down Expand Up @@ -139,16 +181,14 @@ class TodaySpecialData:
item_id: int
name: str
price: int
total_price: int
quantity: int
path: str

def toDict(cls):
return {
"id": cls.item_id,
"name": cls.name,
"price": cls.price,
"total_price": cls.total_price,
"quantity": cls.quantity
"pics": cls.path
}

@dataclass
Expand Down
52 changes: 42 additions & 10 deletions app/order/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,54 @@

from datetime import datetime

from sqlalchemy.sql.operators import notbetween_op
from app.inventory.models import Inventory

from app.order.models import Events, OrderItems, Orders, TodayEventData, TodaySpecialData, UserOrder, Order, generalHistory, EventData
from app.order.models import Events, OrderItems, Orders, TodayEventData, TodaySpecialData, UserOrder, Order, generalHistory, EventData, Graph
from app.userdata.models import User
from app.baseModel import db

def generateTodaySpecialty() -> List[TodaySpecialData]:
todaySpecials = db.session.query(Inventory).filter(Inventory.stock != 0).all()
if not todaySpecials:
raise Exception("no specials menu today")
return list(TodaySpecialData(
item.id,
item.name,
item.price
).toDict() for item in todaySpecials[:5])
aliases = ["Espresso", "Cappucino",
"Cafe Latte", "Americano",
"Vanilla Latte", "French Fries",
"Croiss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,0 ,1 ,0 ,1 ,0 ,0 ,0 ,0 ],
]

allSpeciality = g.graphColouring(5)
for key in allSpeciality.keys():
detailed = list()
for itm in allSpeciality[key]:
print(itm)
specialItem = db.session.query(Inventory).filter(Inventory.name==itm).first()
detailed.append(TodaySpecialData(
item_id=specialItem.id,
name=specialItem.name,
price=specialItem.price,
path=specialItem.path_picture
))
allSpeciality[key] = detailed

return allSpeciality

def generateTodayEvents() -> List[TodayEventData]:
todayDate = datetime.now().date()
Expand Down
74 changes: 37 additions & 37 deletions data_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,87 +16,87 @@
},
{
"menuId": 2,
"namaMenu": "Americano",
"hargaMenu": 24000,
"pathGambar": "/assets/img/menu/americano.jpg"
"namaMenu": "Cappucino",
"hargaMenu": 25000,
"pathGambar": "/assets/img/menu/cappucino.jpg"
},
{
"menuId": 3,
"namaMenu": "Cappucino",
"namaMenu": "Cafe Latte",
"hargaMenu": 25000,
"pathGambar": "/assets/img/menu/cappucino.jpg"
"pathGambar": "/assets/img/menu/cafe-latte.jpg"
},
{
"menuId": 4,
"namaMenu": "Vanilla Latte",
"hargaMenu": 27000,
"pathGambar": "/assets/img/menu/vanilla-latte.jpg"
"namaMenu": "Americano",
"hargaMenu": 24000,
"pathGambar": "/assets/img/menu/americano.jpg"
},
{
"menuId": 5,
"namaMenu": "Cafe Latte",
"hargaMenu": 25000,
"pathGambar": "/assets/img/menu/cafe-latte.jpg"
"namaMenu": "Vanilla Latte",
"hargaMenu": 27000,
"pathGambar": "/assets/img/menu/vanilla-latte.jpg"
},
{
"menuId": 6,
"namaMenu": "Lemon Tea",
"namaMenu": "French Fries",
"hargaMenu": 17000,
"pathGambar": "/assets/img/menu/lemon-tea.jpg"
"pathGambar": "/assets/img/menu/french-fries.jpg"
},
{
"menuId": 7,
"namaMenu": "Lychee Tea",
"hargaMenu": 20000,
"pathGambar": "/assets/img/menu/lychee-tea.jpg"
"namaMenu": "Croissant",
"hargaMenu": 25000,
"pathGambar": "/assets/img/menu/croissant.jpg"
},
{
"menuId": 8,
"namaMenu": "Taro Latte",
"hargaMenu": 20000,
"pathGambar": "/assets/img/menu/taro-latte.jpg"
"namaMenu": "Deluxe Burger",
"hargaMenu": 50000,
"pathGambar": "/assets/img/menu/deluxe-burger.jpg"
},
{
"menuId": 9,
"namaMenu": "Matcha Latte",
"hargaMenu": 25000,
"pathGambar": "/assets/img/menu/matcha-latte.jpg"
"namaMenu": "Potato Wedges",
"hargaMenu": 20000,
"pathGambar": "/assets/img/menu/potato-wedges.jpg"
},
{
"menuId": 10,
"namaMenu": "Chocolate Latte",
"hargaMenu": 25000,
"pathGambar": "/assets/img/menu/chocolate-latte.jpg"
"namaMenu": "Cheese Burger",
"hargaMenu": 45000,
"pathGambar": "/assets/img/menu/cheese-burger.jpg"
},
{
"menuId": 11,
"namaMenu": "French Fries",
"namaMenu": "Lemon Tea",
"hargaMenu": 17000,
"pathGambar": "/assets/img/menu/french-fries.jpg"
"pathGambar": "/assets/img/menu/lemon-tea.jpg"
},
{
"menuId": 12,
"namaMenu": "Potato Wedges",
"namaMenu": "Taro Latte",
"hargaMenu": 20000,
"pathGambar": "/assets/img/menu/potato-wedges.jpg"
"pathGambar": "/assets/img/menu/taro-latte.jpg"
},
{
"menuId": 13,
"namaMenu": "Croissant",
"namaMenu": "Chocolate Latte",
"hargaMenu": 25000,
"pathGambar": "/assets/img/menu/croissant.jpg"
"pathGambar": "/assets/img/menu/chocolate-latte.jpg"
},
{
"menuId": 14,
"namaMenu": "Cheese Burger",
"hargaMenu": 45000,
"pathGambar": "/assets/img/menu/cheese-burger.jpg"
"namaMenu": "Lychee Tea",
"hargaMenu": 20000,
"pathGambar": "/assets/img/menu/lychee-tea.jpg"
},
{
"menuId": 15,
"namaMenu": "Deluxe Burger",
"hargaMenu": 50000,
"pathGambar": "/assets/img/menu/deluxe-burger.jpg"
"namaMenu": "Matcha Latte",
"hargaMenu": 25000,
"pathGambar": "/assets/img/menu/matcha-latte.jpg"
}
]

Expand Down
Binary file removed docs/Flowcharts PNG/addItem.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/addMember.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/addPoint.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/appendItem.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/buyItem.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/generateHash.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/initMembership.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/initStorage.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/main.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/manageMembership.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/manageStorage.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/pay.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/registerMember.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/removeItem.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/returnItem.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/revokeMember.png
Binary file not shown.
Binary file removed docs/Flowcharts PNG/updateMembership.png
Binary file not shown.
1 change: 0 additions & 1 deletion docs/Flowcharts/InitMembership.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/Flowcharts/InitStorage.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/Flowcharts/addItem.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/Flowcharts/addMember.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/Flowcharts/addPoint.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/Flowcharts/appendItem.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/Flowcharts/buyItem.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/Flowcharts/generateHash.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/Flowcharts/main.svg
Diff not rendered.
1 change: 0 additions & 1 deletion docs/Flowcharts/manageMember.svg
Diff not rendered.
1 change: 0 additions & 1 deletion docs/Flowcharts/manageStorage.svg
Diff not rendered.
1 change: 0 additions & 1 deletion docs/Flowcharts/pay.svg
Diff not rendered.
1 change: 0 additions & 1 deletion docs/Flowcharts/registerMember.svg
Diff not rendered.
1 change: 0 additions & 1 deletion docs/Flowcharts/removeItem.svg
Diff not rendered.
1 change: 0 additions & 1 deletion docs/Flowcharts/returnItem.svg
Diff not rendered.
1 change: 0 additions & 1 deletion docs/Flowcharts/revokeMember.svg
Diff not rendered.
1 change: 0 additions & 1 deletion docs/Flowcharts/updateMembership.svg
Diff not rendered.
Binary file removed docs/KissatenBanner.png
Diff not rendered.
Binary file removed docs/Stellar Coffee.png
Diff not rendered.
Binary file added docs/StellarCoffee2.png
Binary file added docs/StellarCoffee_Detail.png
165 changes: 0 additions & 165 deletions docs/flowchart.drawio.svg
Diff not rendered.
Loading

0 comments on commit 708cdbc

Please sign in to comment.