def get_info(): eid = str(input("EID: ")) member = Member.get_by_eid(eid) if not member is None: print("Name: " + str(member.firstName) + " " + str(member.lastName)) print("EID: " + str(member.eid)) print("Email: " + str(member.email)) print("Meetings Attended: " + str(member.attendance)) print("Dues: $" + str(member.dues))
def index(): if request.method == 'POST' and request.form['enter-eid'] == 'Check In': eid = str(request.form['eid']) member = Member.get_by_eid(eid.lower()) if member is None: return render_template('dashboard.html', missingInformation=False, notInSystem=True, allowedIn=False, notAllowedIn=False, eid=eid) if member is not None and member.attendance is None: member.attendance = 0 elif member is not None and member.check_attendance( member.dues, member.attendance + 1): member.attendance += 1 member.atLatestMeeting = True db.session.commit() if not member.email or not member.firstName or not member.lastName: needEmail = not member.email needFirstName = not member.firstName needLastName = not member.lastName return render_template('dashboard.html', eid=eid, needEmail=needEmail, needFirstName=needFirstName, needLastName=needLastName, missingInformation=True, notInSystem=False, allowedIn=False, notAllowedIn=False) return render_template('dashboard.html', missingInformation=False, notInSystem=False, allowedIn=True, notAllowedIn=False, attendance=member.attendance, dues=member.dues, firstName=member.firstName, lastName=member.lastName, date=date) elif member is not None and not member.check_attendance( member.dues, member.attendance + 1): return render_template('dashboard.html', missingInformation=False, notInSystem=False, allowedIn=False, notAllowedIn=True, attendance=member.attendance, dues=member.dues, firstName=member.firstName, lastName=member.lastName, date=date) return render_template('index.html')
def reset_attendance(): eid = str(input("EID: ")) member = Member.get_by_eid(eid) if not member is None: meetings_attended = int( input("How many meetings do you want to reset it to? ")) member.attendance = meetings_attended member.atLatestMeeting = False db.session.commit()
def add_dues(): addDues = True while addDues: eid = str(input("EID: ")) member = Member.get_by_eid(eid) if not member is None: dues = int(input("How much dues do you want to reset it to? ")) member.dues = dues db.session.commit() answer = input("Do you want to continue (y/n)? ") if answer == 'y': addDues = True else: addDues = False
def add_info(): if request.method == 'POST': eid = str(request.form['eid']) member = Member.get_by_eid(eid.lower()) if not member.email: member.email = str(request.form['email']).lower() if not member.firstName: member.firstName = str(request.form['first-name']).title() if not member.lastName: member.lastName = str(request.form['last-name']).title() db.session.commit() return render_template('dashboard.html', notInSystem=False, allowedIn=True, notAllowedIn=False, missingInformation=False, attendance=member.attendance, dues=member.dues, firstName=member.firstName, lastName=member.lastName, date=date)
def get_from_sheet(): row_index = int(input("What is the starting row? ")) end_index = int(input("What is the ending row? ")) for index in range(row_index, end_index): if str(sheet.cell(index, 3).value): eid = str(sheet.cell(index, 3).value).lower() member = Member.get_by_eid(eid) if not member is None: member.firstName = str(sheet.cell(index, 1).value).title() member.lastName = str(sheet.cell(index, 2).value).title() member.email = str(sheet.cell(index, 4).value).lower() # member.attendance = int(sheet.cell(index, 11).value) # if sheet.cell(index, 8).value: # member.dues = int(sheet.cell(index, 8).value) # else: # member.dues = 0 # member.dues = 0 if sheet.cell(index, 8).value: member.attendance = int(sheet.cell(index, 8).value) else: member.attendance = 0 # if sheet.cell(index, 5).value: # member.year = str(sheet.cell(index, 5).value) # else: # member.year = "" # if sheet.cell(index, 7).value: # member.comments = str(sheet.cell(index, 7).value) # else: # member.comments = "" member.rowOnSheet = index db.session.commit() print("I updated the information for", member.firstName, member.lastName) else: eid = str(sheet.cell(index, 3).value).lower() firstName = str(sheet.cell(index, 1).value).title() lastName = str(sheet.cell(index, 2).value).title() email = str(sheet.cell(index, 4).value).lower() dues = 0 # # attendance = int(sheet.cell(index, 11).value) # if sheet.cell(index, 8).value: # dues = int(sheet.cell(index, 8).value) # else: # dues = 0 if sheet.cell(index, 8).value: attendance = int(sheet.cell(index, 8).value) else: attendance = 0 # if sheet.cell(index, 5).value: # year = str(sheet.cell(index, 5).value) # else: # year = "" # if sheet.cell(index, 7).value: # comments = str(sheet.cell(index, 7).value) # else: # comments = "" rowOnSheet = index member = Member(eid=eid, firstName=firstName, lastName=lastName, email=email, dues=dues, attendance=attendance, rowOnSheet=rowOnSheet) db.session.add(member) print("I added", firstName, lastName) db.session.commit() # print("He/she is not in the database.") else: print("There is no one on row", index)
def get_info_reports(): row_index = 2 end_index = 300 for index in range(row_index, end_index): if str(member_info.cell(index, 3).value): eid = str(member_info.cell(index, 3).value).lower() member = Member.get_by_eid(eid) if not member is None: member.firstName = str(member_info.cell(index, 1).value).title() member.lastName = str(member_info.cell(index, 2).value).title() member.email = str(member_info.cell(index, 4).value).lower() # member.attendance = int(sheet.cell(index, 11).value) # if sheet.cell(index, 8).value: # member.dues = int(sheet.cell(index, 8).value) # else: # member.dues = 0 # if sheet.cell(index, 9).value: # member.attendance = int(sheet.cell(index, 9).value) # else: # member.attendance = 0 # if sheet.cell(index, 5).value: # member.year = str(sheet.cell(index, 5).value) # else: # member.year = "" if member_info.cell(index, 6).value: member.comments = str(member_info.cell(index, 6).value) else: member.comments = "" # gotDues = False # for second_index in range(row_index, end_index): # if str(transactions.cell(second_index, 4).value).lower() == (member.firstName + ' ' + member.lastName).lower(): # member.dues = int(transactions.cell(second_index, 2).value) # gotDues = True # if gotDues == False: # member.dues = 0 # member.rowOnSheet = index db.session.commit() print("I updated the information for", member.firstName, member.lastName) else: # print("I have started here.") eid = str(member_info.cell(index, 3).value).lower() firstName = str(member_info.cell(index, 1).value).title() lastName = str(member_info.cell(index, 2).value).title() email = str(member_info.cell(index, 4).value).lower() dues = 0 # attendance = int(sheet.cell(index, 11).value) # if sheet.cell(index, 8).value: # dues = int(sheet.cell(index, 8).value) # else: # dues = 0 # if sheet.attendance(index, 9).value: # attendance = int(sheet.cell(index, 9).value) # else: # attendance = 0 # if sheet.cell(index, 5).value: # year = str(sheet.cell(index, 5).value) # else: # year = "" if member_info.cell(index, 6).value: comments = str(member_info.cell(index, 6).value) else: comments = "" # gotDues = False # print("I have reached here.") # for second_index in range(row_index, end_index): # if str(transactions.cell(second_index, 4).value).lower() == (firstName + ' ' + lastName).lower(): # dues = int(transactions.cell(second_index, 2).value) # gotDues = True # if gotDues == False: # dues = 0 # rowOnSheet = index member = Member(eid=eid, firstName=firstName, lastName=lastName, email=email, dues=dues, comments=comments) db.session.add(member) print("I added", firstName, lastName) db.session.commit() else: print("There is no one on row", index)