예제 #1
0
now = datetime.now()
time = now.strftime('%I:%M %p')
date = now.strftime('%m-%d-%Y')

# date = (now.strftime('%A %B %d, %Y'))

typeCountSet = {
    'day': [0, 0, 0],
    'week': [0, 0, 0],
    'month': [0, 0, 0],
    'year': [0, 0, 0]
}

typeCountDay = []
typeCountSet['day'][0] = DB.getJobTypeCount(0)[0]
typeCountSet['day'][1] = DB.getJobTypeCount(1)[0]
typeCountSet['day'][2] = DB.getJobTypeCount(2)[0]
for each in typeCountSet['day']:
    typeCountDay.append(each)

typeCountWeek = []
typeCountSet['week'][0] = DB.getJobTypeCount(3)[0]
typeCountSet['week'][1] = DB.getJobTypeCount(4)[0]
typeCountSet['week'][2] = DB.getJobTypeCount(5)[0]
for each in typeCountSet['week']:
    typeCountWeek.append(each)

typeCountMonth = []
typeCountSet['month'][0] = DB.getJobTypeCount(6)[0]
typeCountSet['month'][1] = DB.getJobTypeCount(7)[0]
예제 #2
0
def index():

    page = "THE DASHBOARD"
    now = datetime.now()
    today = now.strftime('%A %B %d, %Y')
    runningJobs = DB.RunningJobsCount()
    dayCount = DB.getJobsCompleteToday()
    weekCount = DB.getJobsCompleteThisWeek()
    monthCount = DB.getJobsCompleteThisMonth()

    typeCountSet = {
        'day': [0, 0, 0],
        'week': [0, 0, 0],
        'month': [0, 0, 0],
        'year': [0, 0, 0]
    }

    typeCountDay = []
    typeCountSet['day'][0] = DB.getJobTypeCount(0)[0]
    typeCountSet['day'][1] = DB.getJobTypeCount(1)[0]
    typeCountSet['day'][2] = DB.getJobTypeCount(2)[0]
    for each in typeCountSet['day']:
        typeCountDay.append(each)

    typeCountWeek = []
    typeCountSet['week'][0] = DB.getJobTypeCount(3)[0]
    typeCountSet['week'][1] = DB.getJobTypeCount(4)[0]
    typeCountSet['week'][2] = DB.getJobTypeCount(5)[0]
    for each in typeCountSet['week']:
        typeCountWeek.append(each)

    typeCountMonth = []
    typeCountSet['month'][0] = DB.getJobTypeCount(6)[0]
    typeCountSet['month'][1] = DB.getJobTypeCount(7)[0]
    typeCountSet['month'][2] = DB.getJobTypeCount(8)[0]
    for each in typeCountSet['month']:
        typeCountMonth.append(each)

    typeCountYear = []
    typeCountSet['year'][0] = DB.getJobTypeCount(9)[0]
    typeCountSet['year'][1] = DB.getJobTypeCount(10)[0]
    typeCountSet['year'][2] = DB.getJobTypeCount(11)[0]
    for each in typeCountSet['year']:
        typeCountYear.append(each)

# Bar Chart=========================================
    CellOBJ = {
        "Large Hock": 0,
        "Pilot Hock": 0,
        "2 Gal Ross": 0,
        "10 Gal Ross": 0,
        "40 Gal Ross": 0,
        "100 Gal Ross": 0,
        "Mezz Tank": 0,
        "Activator": 0,
        "1/2 Gal Ross": 0,
    }

    cellcount = DB.getTodaysCellCount()
    for cell in cellcount:
        CellOBJ[cell[0]] = cell[1]
        print(CellOBJ[cell[0]])

    cellData = [
        CellOBJ["Pilot Hock"], CellOBJ["Large Hock"], CellOBJ["1/2 Gal Ross"],
        CellOBJ["2 Gal Ross"], CellOBJ["10 Gal Ross"], CellOBJ["40 Gal Ross"],
        CellOBJ["100 Gal Ross"], CellOBJ["Mezz Tank"], CellOBJ["Activator"]
    ]
    # Bar Chart =========================================

    output = {
        'runningJobs': runningJobs,
        'dayCount': dayCount,
        'weekCount': weekCount,
        'monthCount': monthCount
    }

    return render_template('index.html',
                           output=output,
                           page=page,
                           today=today,
                           cellData=json.dumps(cellData),
                           typeCountDay=json.dumps(typeCountDay),
                           typeCountWeek=json.dumps(typeCountWeek),
                           typeCountMonth=json.dumps(typeCountMonth),
                           typeCountYear=json.dumps(typeCountYear))