def select_records_comfortable(): if request.method == 'POST': print(request.form) python_records = CallDatabase.web_select_specific(request.form) return render_template("show_records.html", html_records=python_records) else: table = CallDatabase.web_select_overall() table = utils.total_seconds(table) uniques = utils.get_unique(table) return render_template("select_records_comfortable.html", uniques=uniques)
def participate(event, userId): if '週六追求簽到' in event.message.text: try: text_list = event.message.text.split('/') if text_list[3] == '會參加且會留下用餐': pa = 'A' if text_list[3] == '會參加但不留下用餐': pa = 'B' if text_list[3] == '因有事無法參加': pa = 'C' record_list = [userId, text_list[1], pa, text_list[2]] reply = CallDatabase.line_insert_record(record_list) line_bot_api.reply_message(event.reply_token, TextSendMessage(text=reply)) except: line_bot_api.reply_message(event.reply_token, TextSendMessage(text='資料匯入失敗!')) return True if '查看簽到記錄' in event.message.text: line_bot_api.reply_message( event.reply_token, TextSendMessage(text='https://orderstudent.herokuapp.com/')) return True else: return False
def location_search(event): #Text Message should start from 'location of' and followed by the name of the hospital if 'location of' in event.message.text.lower(): try: try: target = event.message.text[12:] lat, lon = CallDatabase.getcoordinates(target) location = LocationSendMessage(title=target, address='Hong Kong', latitude=float(lat), longitude=float(lon)) line_bot_api.reply_message(event.reply_token, location) except: #reply Sanatorium & Hospital if fail lat = 22.269562 lon = 114.1807733 line_bot_api.reply_message( event.reply_token, LocationSendMessage('Hong Kong Sanatorium & Hospital', 'Hong Kong', lat, lon)) except: line_bot_api.reply_message( event.reply_token, TextSendMessage(text="Sorry, failed to get location.")) return True else: return False
def insert_record(event): if '草泥馬訓練紀錄' in event.message.text: try: record_list = utils.prepare_record(event.message.text) reply = CallDatabase.line_insert_record(record_list) line_bot_api.reply_message(event.reply_token, TextSendMessage(text=reply)) except: line_bot_api.reply_message(event.reply_token, TextSendMessage(text='失敗了')) return True else: return False
def home(): python_records = CallDatabase.web_select_overall() return render_template("show_records.html", html_records=python_records)
def spline_chart(): table = CallDatabase.web_select_overall() table = utils.total_seconds(table) uniques = utils.get_unique(table) return render_template("spline_chart.html", table=table, uniques=uniques)