예제 #1
0
def run_add_entry_process():
    """Creates new time entry and saves to database.

    Obtains field information from user, creates new time entry object, and
    then saves the entry's information into the database.
    """

    add = Add_Menu()
    add.show()
    employee = get_employee()
    clear_screen()
    add.show()
    date = get_date()
    clear_screen()
    add.show()
    title = get_title()
    clear_screen()
    add.show()
    time_spent = get_time_spent()
    clear_screen()
    add.show()
    notes = get_notes()
    Time_Entry.create(employee_name=employee,
                      date=date,
                      title=title,
                      time_spent=time_spent,
                      notes=notes)
    clear_screen()
    input("The entry has been added! Press Enter to return to main menu.")
    clear_screen()
예제 #2
0
from peewee import *

from models.employee import Employee
from models.time_entry import Time_Entry

db = SqliteDatabase('time_entries.db')


def initialize():
    db.connect()
    db.create_tables([Employee, Time_Entry], safe=True)


if __name__ == '__main__':
    initialize()
    ee1 = Employee.create(name="Brian Peterson")
    Time_Entry.create(name=ee1.name,
                      title="test title",
                      time_spent=50,
                      notes="These are the notes")