diff --git a/Group 7: Version 1.0.4/README.md b/Group 7: Version 1.0.4/README.md new file mode 100644 index 0000000..8719973 --- /dev/null +++ b/Group 7: Version 1.0.4/README.md @@ -0,0 +1,8 @@ +# Codegym2019 +Group 7:Tasker +Release Version 1.0.4 +Group Members: +1.Sohan Kale(lead) +2.Purva Gaikwad +3.Anivedh Auradhkar +4.Aditya Bakare diff --git a/Group 7: Version 1.0.4/Tasker _ the to-do list(1).pdf b/Group 7: Version 1.0.4/Tasker _ the to-do list(1).pdf new file mode 100644 index 0000000..293c4d3 Binary files /dev/null and b/Group 7: Version 1.0.4/Tasker _ the to-do list(1).pdf differ diff --git a/Group 7: Version 1.0.4/__pycache__/app.cpython-36.pyc b/Group 7: Version 1.0.4/__pycache__/app.cpython-36.pyc new file mode 100644 index 0000000..d67ab68 Binary files /dev/null and b/Group 7: Version 1.0.4/__pycache__/app.cpython-36.pyc differ diff --git a/Group 7: Version 1.0.4/__pycache__/app.cpython-37.pyc b/Group 7: Version 1.0.4/__pycache__/app.cpython-37.pyc new file mode 100644 index 0000000..9c36db4 Binary files /dev/null and b/Group 7: Version 1.0.4/__pycache__/app.cpython-37.pyc differ diff --git a/Group 7: Version 1.0.4/__pycache__/database.cpython-37.pyc b/Group 7: Version 1.0.4/__pycache__/database.cpython-37.pyc new file mode 100644 index 0000000..4fc63b2 Binary files /dev/null and b/Group 7: Version 1.0.4/__pycache__/database.cpython-37.pyc differ diff --git a/Group 7: Version 1.0.4/app.py b/Group 7: Version 1.0.4/app.py new file mode 100644 index 0000000..daaa512 --- /dev/null +++ b/Group 7: Version 1.0.4/app.py @@ -0,0 +1,168 @@ +from flask import Flask, render_template, request,redirect +from flask_sqlalchemy import SQLAlchemy +#from flaskwebgui import FlaskUI +import threading +import time +from win10toast import ToastNotifier +#import webbrowser +from threading import Timer + +app = Flask(__name__) +#ui=FlaskUI(app) +import datetime + +app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///read.db' +db = SQLAlchemy(app) +toast = ToastNotifier() +import smtplib +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText + + +# Data for emailing Report +sender= "my@email.com" +sender_password= r"password" +msg = MIMEMultipart('alternative') +msg['Subject'] = "Daily Task Summary" +msg['From'] = sender +s = smtplib.SMTP_SSL('smtp.gmail.com') +s.login(sender, sender_password) + +class Task(db.Model): + + id = db.Column(db.Integer, primary_key = True) + task = db.Column(db.String(), nullable=False,default="") + time1 = db.Column( db.String(), nullable = False) + time2 = db.Column( db.String(), nullable = False) + status = db.Column( db.String(), nullable=False, default="incomplete") + is_deleted = db.Column( db.String(), nullable = False, default = "no" ) + + def __repr__(self): + return("Hello") + +@app.route('/',methods = ['POST','GET']) +def index(): + flag = 0 + if request.method == 'POST': + new_task1 = request.form.get('task') + time1 = request.form.get('time1') + time2 = request.form.get('time2') + tasks = Task.query.order_by(Task.time1).all() + if tasks==[] and new_task1!="" and time1!="" and time2!="": + + try: + t =Task(task=new_task1, time1 = time1,time2= time2 ) + db.session.add(t) + db.session.commit() + #toast.show_toast(title=f"{t.task}", msg=f"{t.task}",threaded=True) + except: + return "There was a problem" + return redirect('/') + + elif tasks != [] and new_task1!="" and time1!="" and time2!="": + flag2=0 + for task in tasks: + if time1==task.time1 and time2==task.time2 and task.is_deleted=="no": + flag2=1 + if flag2==0: + try: + t =Task(task=new_task1, time1 = time1,time2= time2 ) + db.session.add(t) + db.session.commit() + #toast.show_toast(title=f"{t.task}", msg=f"{t.task}",threaded=True) + except: + return "There was a problem" + return redirect('/') + tasks = Task.query.order_by(Task.time1).all() + return render_template('index.html', tasks = tasks) + +@app.route('/delete/') +def delete(id): + task = Task.query.get(id) + #db.session.delete(task) + task.is_deleted = "yes" + db.session.commit() + return redirect('/') + +@app.route('/update/', methods = ['POST','GET']) +def update(id): + taask = Task.query.get_or_404(id) + tasks = Task.query.order_by(Task.time1).all() + if request.method == 'POST': + t= request.form.get('task') + time_1 = request.form.get('time1') + time_2 = request.form.get('time2') + flag = 1 + for task in tasks: + if time_1 == task.time1 and task.is_deleted=="no": + flag = 0 + if flag : + try: + taask.time1 = time_1 + taask.time2= time_2 + taask.task = t + db.session.commit() + return redirect('/') + except: + return "there was a problem" + else: + return redirect('/') + + else: + return render_template('update.html',task=taask) + +@app.route('/done/') +def done(id): + taask = Task.query.get_or_404(id) + taask.status = "completed" + db.session.commit() + return redirect('/') + +@app.route('/getreport', methods=['GET','POST']) +def getreport(): + tasks = Task.query.order_by(Task.time1).all() + if request.method == 'POST': + try: + #s.connect() + html = render_template('getrep.html',tasks=tasks) + part2 = MIMEText(html, 'html') + reciever =request.form.get('email') + msg['To'] = reciever + msg.attach(part2) + s.sendmail(sender, reciever, msg.as_string()) + s.quit() + except: + return "There was problem in email or network" + + return render_template('getrep.html',tasks=tasks) + +@app.route('/removeall') +def removeall(): + tasks = Task.query.all() + try: + for task in tasks: + db.session.delete(task) + db.session.commit() + except: + return "there was a problem" + return redirect('/') + +def notification_scheduler(): + toast = ToastNotifier() + import datetime + while True: + tasks = Task.query.order_by(Task.time1).all() + for task in tasks: + now = datetime.datetime.now() + current_time = now.strftime("%H:%M:%S") + if task.time1 in current_time and task.is_deleted =="no": + toast.show_toast(title=f"{task.task}", msg=f"{task.task}",threaded=True) + time.sleep(30) + print(current_time) + time.sleep(1) + + +if __name__ == "__main__": + x = threading.Thread(target=notification_scheduler , args=(),daemon=True) + x.start() + app.run(debug=True,) \ No newline at end of file diff --git a/Group 7: Version 1.0.4/app.pyc b/Group 7: Version 1.0.4/app.pyc new file mode 100644 index 0000000..79d3d54 Binary files /dev/null and b/Group 7: Version 1.0.4/app.pyc differ diff --git a/Group 7: Version 1.0.4/read.db b/Group 7: Version 1.0.4/read.db new file mode 100644 index 0000000..f32fc0c Binary files /dev/null and b/Group 7: Version 1.0.4/read.db differ diff --git a/Group 7: Version 1.0.4/requirements.txt b/Group 7: Version 1.0.4/requirements.txt new file mode 100644 index 0000000..e7045a4 --- /dev/null +++ b/Group 7: Version 1.0.4/requirements.txt @@ -0,0 +1,12 @@ +Click==7.0 +Flask==1.1.1 +itsdangerous==1.1.0 +Jinja2==2.10.3 +MarkupSafe==1.1.1 +Werkzeug==0.16.0 +flask-sqlalchemy +win10toast==0.9 +SQlAlchemy==1.3.11 +requests==2.22.0 +flaskwebgui==0.0.8 + diff --git a/Group 7: Version 1.0.4/templates/getrep.html b/Group 7: Version 1.0.4/templates/getrep.html new file mode 100644 index 0000000..69e7807 --- /dev/null +++ b/Group 7: Version 1.0.4/templates/getrep.html @@ -0,0 +1,74 @@ + + + + + + + Tasker + + + +
+
+
+
+

REPORT

+
+ +

+ + +
+
+ +
+ + + + + + + + + + {% for task in tasks %} + + + + + + + {% endfor %} +
TaskFromToStatus
{{task.task}}{{task.time1}}{{task.time2}}{{task.status}}
+
+ + + \ No newline at end of file diff --git a/Group 7: Version 1.0.4/templates/index.html b/Group 7: Version 1.0.4/templates/index.html new file mode 100644 index 0000000..5137372 --- /dev/null +++ b/Group 7: Version 1.0.4/templates/index.html @@ -0,0 +1,106 @@ + + + + + + + Tasker + + + +
+ +

TASKER

+
+ +

Task :

+ From: + + To: +

+ +
+
+

+
+ + + + + + + + + + {% for task in tasks %} + {% if task.is_deleted == 'no' %} + + + + + + + + {% endif %} + {% endfor %} +
TasksFromToStatusOption
{{task.task}}{{task.time1}}{{task.time2}}{{task.status}}Delete + + Update + Done +
+
+ + + + \ No newline at end of file diff --git a/Group 7: Version 1.0.4/templates/update.html b/Group 7: Version 1.0.4/templates/update.html new file mode 100644 index 0000000..17d924d --- /dev/null +++ b/Group 7: Version 1.0.4/templates/update.html @@ -0,0 +1,40 @@ + + + + + + + Update + + + +
+ +
+ +

+ +

+ + +
+ + +
+ + + \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index b0f2045..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Codegym2019 -Prework of codegym workshop needs to be uploaded here