def setFound(): bid = request.args.get('bid') current_time = datetime.now() current_time = current_time.strftime("%H:%M:%S") # Update on last seen that client has been found common.database_connection( 'update last_seen set searching = FALSE where bid = %s', 'update', bid) # Update on missing_occurences what time client was found common.database_connection( 'update missing_occurences set discovered_timestamp = %s where bid = %s and discovered_timestamp IS NULL', 'update', current_time, bid) return "OK"
def setSearching(): bid = request.args.get('bid') current_time = datetime.now() current_time = current_time.strftime("%H:%M:%S") # Update on last seen that client is being searched for common.database_connection( 'update last_seen set searching = TRUE where bid = %s', 'update', bid) # Update on missing_occurences what time it was acknowledged common.database_connection( 'update missing_occurences set acknowledged_timestamp = %s where bid = %s and acknowledged_timestamp IS NULL', 'update', current_time, bid) return "OK"
def getMissingOccurence(): bid = request.args.get('bid') missing = common.database_connection( 'select * from missing_occurences where bid = %s', 'select', bid) return json.dumps(missing) # @missing_api.route('/getLastMissingOccurence', methods=['GET']) # def getLastMissingOccurence(): # missing = common.database_connection('select * from missing_occurences order_by id desc limit 1', 'select') # return json.dumps(missing)
def goneHome(): bid = request.args.get('bid') common.database_connection( 'update last_seen set gone_home = TRUE where bid = %s', 'update', bid) return "OK"
def resetLastSeen(): common.database_connection('delete from last_seen', 'update') return
def setInterval(): interval = request.args.get('interval') common.database_connection('update interval_checker set interval = %d where bid = 1', 'update', interval) return
def getInterval(): interval = common.database_connection('select interval from interval_checker where id = 1', 'select') return json.dumps(interval)
def getAllRawData(): rows = common.database_connection("select (bid, timestamp, receiverid) from raw_data", "select") # print (json.dumps(rows)) return json.dumps(rows)
def getWatchlist(): rows = common.database_connection('select * from watch_list', 'select') return json.dumps(rows)
def getAllStaffs(): rows = common.database_connection('select * from staff_details', 'select') return json.dumps(rows)
def getStaff(name): name = request.args.get('name') rows = common.database_connection( "select * from staff_details where name like '%%%s%%'", 'select', name) return json.dumps(rows)
def getAllMissingOccurences(): missing = common.database_connection('select * from missing_occurences', 'select') return json.dumps(missing)
def getFeeTypes(): rows = common.database_connection("select * from elderly_fees", 'select') return json.dumps(rows)
def getFee(feetype): feetype = request.args.get('feetype') rows = common.database_connection( "select * from elderly_fees where condition = %s", 'select', feetype) return json.dumps(rows)
def getClient(): bid = request.args.get('bid') rows = common.database_connection( "select * from client_details where bid = %s", 'select', bid) return json.dumps(rows)
def getAllLastSeen(): rows = common.database_connection("select * from last_seen", "select") return json.dumps(rows)
def getAllClients(): rows = common.database_connection("Select * from client_details", "select") return json.dumps(rows)
def getAllAttendance(): attendance = common.database_connection('select * from daily_attendance', 'select') return json.dumps(attendance)
def resetRawData(): common.database_connection('delete from raw_data', 'update') return