def main_menu_loop():
    main_menu = ['Add Log', 'Search Logs', 'Exit Program']
    while True:
        clear()
        nav = menu(main_menu)

        if nav == 'Add Log':
            date = get_date()
            employee_name = get_text('employee name', optional=False)
            task_name = get_text('task name', optional=False)
            time_spent = get_time_spent()
            note = get_text('note', optional=True)

            Log.create(date=date,
                       employee_name=employee_name,
                       task_name=task_name,
                       time_spent=time_spent,
                       note=note)

            input("\nLog Created! Press any key to continue.")

        if nav == 'Search Logs':
            search_loop()

        if nav == 'Exit Program':
            break
예제 #2
0
    def setUp(self):
        # Bind model class to test db.
        Log.bind(test_db, bind_refs=False, bind_backrefs=False)

        # Connect to in-memory test database and create Log table
        test_db.connect()
        test_db.create_tables([Log])

        Log.create(date='01/01/2000',
                   employee_name='Alpha',
                   task_name='Task One',
                   time_spent=1,
                   note='Won')
        Log.create(date='01/02/2000',
                   employee_name='Beta',
                   task_name='Task Two',
                   time_spent=2,
                   note='Too')