Пример #1
0
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"
Пример #2
0
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"
Пример #3
0
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)
Пример #4
0
def goneHome():
    bid = request.args.get('bid')
    common.database_connection(
        'update last_seen set gone_home = TRUE where bid = %s', 'update', bid)
    return "OK"
Пример #5
0
def resetLastSeen():
    common.database_connection('delete from last_seen', 'update')
    return
Пример #6
0
def setInterval():
    interval = request.args.get('interval')
    common.database_connection('update interval_checker set interval = %d where bid = 1', 'update', interval)
    return
Пример #7
0
def getInterval():
    interval = common.database_connection('select interval from interval_checker where id = 1', 'select')
    return json.dumps(interval)
Пример #8
0
def getAllRawData():
    rows = common.database_connection("select (bid, timestamp, receiverid) from raw_data", "select")
    # print (json.dumps(rows))
    return json.dumps(rows)
Пример #9
0
def getWatchlist():
    rows = common.database_connection('select * from watch_list', 'select')
    return json.dumps(rows)
Пример #10
0
def getAllStaffs():
    rows = common.database_connection('select * from staff_details', 'select')
    return json.dumps(rows)
Пример #11
0
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)
Пример #12
0
def getAllMissingOccurences():
    missing = common.database_connection('select * from missing_occurences',
                                         'select')
    return json.dumps(missing)
Пример #13
0
def getFeeTypes():
    rows = common.database_connection("select * from elderly_fees", 'select')
    return json.dumps(rows)
Пример #14
0
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)
Пример #15
0
def getClient():
    bid = request.args.get('bid')
    rows = common.database_connection(
        "select * from client_details where bid = %s", 'select', bid)
    return json.dumps(rows)
Пример #16
0
def getAllLastSeen():
    rows = common.database_connection("select * from last_seen", "select")
    return json.dumps(rows)
Пример #17
0
def getAllClients():
    rows = common.database_connection("Select * from client_details", "select")
    return json.dumps(rows)
Пример #18
0
def getAllAttendance():
    attendance = common.database_connection('select * from daily_attendance',
                                            'select')
    return json.dumps(attendance)
Пример #19
0
def resetRawData():
    common.database_connection('delete from raw_data', 'update')
    return