Skip to content
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
1 change: 1 addition & 0 deletions APIkeys.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
polygonAPIkey = 'acbdefghhijklmnopqrstuvwxyz'
64 changes: 64 additions & 0 deletions ScheduleManagerBD.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
DROP DATABASE IF EXISTS `MeetingScheduler` ;
CREATE DATABASE `MeetingScheduler` ;
USE `MeetingScheduler` ;

SET NAMES utf8 ;
SET character_set_client = utf8mb4 ;


CREATE TABLE `rooms` (
`room_num` int(4) NOT NULL,
`capacity` int(11) NOT NULL,
PRIMARY KEY (`room_num`)
) ENGINE=InnoDB;

INSERT INTO `rooms` VALUES (100,30);

CREATE TABLE `meetings` (
`meeting_id` int(11) NOT NULL,
`time_id` int(11) NOT NULL,
`room_num` int(4) NOT NULL,
`desc` varchar(100) NULL,
PRIMARY KEY (`meeting_id`),
KEY `fk_room_num` (`room_num`),
CONSTRAINT `fk_room_numx` FOREIGN KEY (`room_num`) REFERENCES `rooms` (`room_num`)
) ENGINE=InnoDB;

INSERT INTO `meetings` VALUES (1,1,100, 'This is a test');

CREATE TABLE `meeting_times` (
`meeting_time_id` int(11) NOT NULL,
`meeting_id` int(11) NOT NULL,
`date_time_start` datetime NOT NULL,
`date_time_end` datetime NOT NULL,
PRIMARY KEY (`meeting_time_id`),
KEY `fk_meeting_idx` (`meeting_id`),
CONSTRAINT `fk_meeting_idx` FOREIGN KEY (`meeting_id`) REFERENCES `meetings` (`meeting_id`)
) ENGINE=InnoDB;

INSERT INTO `meeting_times` VALUES (1,1,'2000-01-01 22:00:00', '2000-01-01 23:00:00');

CREATE TABLE `people` (
`people_id` int(11) NOT NULL,
`name` varchar(50) NOT NULL,
`isManager` bool DEFAULT 0,
`meeting_id` int(11) DEFAULT NULL,
`password` varchar(50) NOT NULL,
PRIMARY KEY (`people_id`),
KEY `fk_meeting_idxs` (`meeting_id`),
CONSTRAINT `fk_meeting_idxs` FOREIGN KEY (`meeting_id`) REFERENCES `meetings` (`meeting_id`)
) ENGINE=InnoDB;

INSERT INTO `people` VALUES (1,'default',1,1,'password');

CREATE TABLE `work_times` (
`work_time_id` int(11) NOT NULL,
`people_id` int(11) NOT NULL,
`date_time_start` datetime NOT NULL,
`date_time_end` datetime NOT NULL,
PRIMARY KEY (`work_time_id`),
KEY `fk_people_idx` (`people_id`),
CONSTRAINT `fk_people_idx` FOREIGN KEY (`people_id`) REFERENCES `people` (`people_id`)
) ENGINE=InnoDB;

INSERT INTO `work_times` VALUES (1,1,'2000-01-01 22:00:00', '2000-01-01 23:00:00');
Binary file added __pycache__/APIkeys.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/app.cpython-312.pyc
Binary file not shown.
Binary file modified __pycache__/app.cpython-39.pyc
Binary file not shown.
106 changes: 88 additions & 18 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,99 @@
import re
from datetime import datetime

from flask import Flask, render_template, request
from datetime import time
from flask_sqlalchemy import SQLAlchemy
from flask import Flask, render_template, request, redirect, url_for

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db'

app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)

class employee(db.Model):
name = db.Column(db.String(100), nullable = False)
employee_id = db.Column(db.String(100), primary_key = True)
age = db.Column(db.Integer, nullable = False)
start_work = db.Column(db.types.Time())
end_work = db.Column(db.types.Time())
Password = db.Column(db.String(100),nullable = True)
# People = db.Column(db.PickleType, nullable = True)

class meeting(db.Model):
Meeting_id = db.Column(db.Integer, primary_key = True)
Start = db.Column(db.types.Time(), nullable = False)
End = db.Column(db.types.Time(), nullable = False)
Room_number = db.Column(db.Integer, nullable = False)
People = db.Column(db.PickleType, nullable = False)

class room(db.Model):
Room_number = db.Column(db.Integer, primary_key = True)
meetings = db.Column(db.PickleType, nullable = True)

@app.route("/")
class groupdb(db.Model):
group_id = db.Column(db.Integer, primary_key = True)
group_db = db.Column(db.PickleType, nullable = False)

class group():
group_name = ""
employees = []
def __init__ (self,group_name,employees):
self.group_name = group_name
self.employees = employees

@app.before_request
def create_and_populate_db():
db.create_all()
if employee.query.count == 0:
employees = [
employee(name='Jim', id = '1', age=26, start_work = time(8,30,0,0), end_work= time(18,30,0,0), Password = 123),
employee(name='Jane', id = '2', age=53, start_work = time(7,30,0,0),end_work= time(18,30,0,0), Password = 456),
employee(name='John', id = '3', age=34, start_work = time(8,0,0,0), end_work= time(18,30,0,0),Password = 789)
]
db.session.bulk_save_objects(employees)
db.session.commit()

@app.route("/")
def home():
return render_template('index.html')


@app.route("/hello/<name>/<password>", )
def hello_there(name,password):
now = datetime.now()
formatted_now = now.strftime("%A, %d %B, %Y at %X")

# Filter the name argument to letters only using regular expressions. URL arguments
# can contain arbitrary text, so we restrict to safe characters only.
match_object = re.match("[a-zA-Z]+", name)
@app.route('/login', methods = ["GET","POST"])
def hello_there():
if request.method == "POST":
if (employee.query.count() == 0):
employees = [
employee(name='Jim Davis', employee_id = '1', age=26, start_work = time(8,30,0,0), end_work= time(18,30,0,0), Password = 123),
employee(name='Jane Doe', employee_id = '2', age=53, start_work = time(7,30,0,0),end_work= time(18,30,0,0), Password = 456),
employee(name='John Dorne', employee_id = '3', age=34, start_work = time(8,0,0,0), end_work= time(18,30,0,0),Password = 789)
]
db.session.bulk_save_objects(employees)
db.session.commit()
# group1 = group("group1", [employee.query.get(1),employee.query.get(2),employee.query.get(3)])
if (meeting.query.count() == 0):
meetings = [
meeting(Meeting_id = 1,Start = time(8,30,0,0) , End = time(11,30,0,0) ,Room_number = 1, People = group1),
meeting(Meeting_id = 2,Start = time(11,50,0,0) , End = time(12,30,0,0) ,Room_number = 2, People = group1)
]
db.session.bulk_save_objects(meetings)
db.session.commit()
username = request.form.get("username")
password = request.form.get("password")
employee_num = employee.query.count()
print(employee.query.count())
for i in range(employee.query.count()):
info = employee.query.get(i+1)
if (info.name == username) and (info.Password == password):
return render_template('input.html')

if match_object:
clean_name = match_object.group(0)
else:
clean_name = "Friend"
@app.route('/meeting_input', methods = ["GET","POST"])
def main_menu():
if request.method == "POST":
# Room_number = request.form.get("username")
# password = request.form.get("password")

content = "Hello there, " + clean_name + "! It's " + formatted_now + "your password is" + password
return content
return render_template('input.html')
# todo; once the password is collected, we need to check
# it against all of the other passwords in the database

if __name__ == '__main__':
app.run(debug=True)
Binary file added instance/data.db
Binary file not shown.
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#py -m pip install -r requirements.txt (do this to install all realavent python files)
pandas
polygon-api-client
numpy
sqlalchemy
flask
Flask-SQLAlchemy
requests
flask-marshmallow
marshmallow-sqlalchemy
6 changes: 3 additions & 3 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ <h1>This is a Login Page</h1>
title = "goes to Google">
Click this link
</a>-->
<form action = "/hello/<name>/<password>" , method="post">
<form action = "/login" , method="POST">
<!-- </form> Todo: Tony (Format this login page to look more modern)-->
<label for="username">Username:</label><br>
<input type="text" id = "username" name = "username"><br>
<input type="text" id = "username" name = "username" placeholder = "username"> <br>
<label for="Password">Password:</label><br>
<input type="text" id = "Password" name = "Password"><br>
<input type="text" id = "password" name = "password" placeholder = "password"> <br>

<input type="Reset"> <br>
<input type="Submit">
Expand Down
81 changes: 81 additions & 0 deletions templates/input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en">

<head>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<title>Enter Meeting/People</title>
<style>
#div1 {
display: inline-block;
width:150px;
}
#div2 {
vertical-align:top;
display: inline-block;
width:150px;
}</style>
</head>

<body>
<div class = "container mt-5">
<!--form for adding meeting info-->
<h2>Enter Meeting</h2>
<form method="post" class="mt-3">
<!-- we do not need the user to assign Meeting_id's this will be done by the program
<div class="form-group">
<label for="Meeting_id">ID:</label>
<input type="number" class="form-control" id="Meeting_id" name="Meeting_id" required>
-->
</div>
<div class="form-group">
<label for="Room_number">Room Number:</label>
<input type="number" class="form-control" id="Room_number" name="Room_number" required>
</div>
<div class="form-group">
<label for="People">People:</label>
<input type="text" class="form-control" id="People" name="People">
</div>
<h3 class="mt-3">Meeting Time:</h3>
<div class="form-group">
<div id = "div1">
<label for="Meeting_Start_Time">Start:</label>
<input type="time" class="form-control" id="Start" name="Start" required>
</div>
<div id = "div2">
<label for="Meeting_End_Time">End:</label>
<input type="time" class="form-control" id="End" name="End" required>
</div>
</div>
<button type="submit" class="btn btn-success">Add Meeting</button>
</form>

<!-- for for adding people-->
<h2 class="mt-5">Add Person</h2>
<form method="post" class="mt-3">
<div class="form-group">
<label for="Name">Name:</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<!--
<div class="form-group">
<label for="employee_id">ID:</label>
<input type="number" class="form-control" id="employee_id" name="employee_id" required>
-->
</div>
<h3 class="mt-3">Work Time:</h3>
<div class="form-group">
<div id = "div1">
<label for="Work_Start_Time">Start:</label>
<input type="time" class="form-control" id="start_work" name="start_work" required>
</div>
<div id = "div2">
<label for="Work_End_Time">End:</label>
<input type="time" class="form-control" id="end_work" name="end_work" required>
</div>
</div>
<button type="submit" class="btn btn-success">Add Person</button>
</form>

</div>
</body>
4 changes: 4 additions & 0 deletions templates/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!DOCTYPE html>
<html>

</html>
43 changes: 43 additions & 0 deletions templates/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
head{


}

body{
background-image: url(https://wallpaper.dog/large/20395458.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;


/*background: linear-gradient(skyblue, rgb(132, 83, 155));
background-repeat: no-repeat;
background-attachment: fixed;
margin-top: 300px;
margin-left: auto;
margin-right: auto;
text-align: center;*/
}

h1{
font-family: "impact";
}

p{
font-family: "consolas";
opacity: 1
}

#box{
margin-top: 300px;
margin-left: auto;
margin-right: auto;
text-align: center;
border: 5px solid;
border-style: outset;
width: 500px;
height: 300px;
background-color: rgb(255, 255, 255,.3);

}
Loading