예제 #1
0
파일: app.py 프로젝트: yulu9206/seenit_lu
def show_votes(table, id):
    print ("【Upvotes】:")
    if table == 'comment':
        cu.read_all(id)
    else:
        pu.read_all(id)
    print ("【Downvotes】:")    
    if table == 'comment':
        cd.read_all(id)
    else:
        pd.read_all(id)
    print("-" * 40)
    print ("                Vote Menu")
    print("-" * 40)
    logging.info("Print show_votes menu - Request user's response\n")
    if admin == True:
        method = input('''   
            1 = Up
            2 = Down
            3 = Delete Up
            4 = Delete Down
            5 = Main Menu
            6 = Exit
            ''')
    else:
        method = input('''   
            1 = Up
            2 = Down
            5 = Main Menu
            6 = Exit
            ''')
    if method == '1':
        logging.info("Response: 1 - Up\n")
        insert_vote(table, 'up', id)
    elif method == '2':
        logging.info("Response: 2 - Down\n")
        insert_vote(table, 'down', id)
    elif method == '3':
        logging.info("Response: 3 - Delete Up\n")
        delete_vote(table, 'up', id)
    elif method == '4':
        logging.info("Response: 4 - Delete Down\n")
        delete_vote(table, 'down', id)
    elif method == '6':
        logging.info("Response: 6 - Exit")
        exit()
    else:
        logging.info("Response: 5 - Main Menu")
        main_menu()
예제 #2
0
파일: app.py 프로젝트: PC-Driver/Seenit
def show_votes(table, id):
    if table == 'comment':
        up = cu.read_all(id)
    else:
        up = pu.read_all(id)
    print("Upvotes:")
    print(up)
    if table == 'comment':
        down = cd.read_all(id)
    else:
        down = pd.read_all(id)
    print("Downvotes:")
    print(down)
    print("-" * 40)
    print("                Vote Menu")
    print("-" * 40)
    f.writing("Print show_votes menu - Request user's response\n")
    if admin == True:
        method = input('''   
            1 = Up
            2 = Down
            3 = Delete Up
            4 = Delete Down
            5 = Main Menu
            6 = Exit
            ''')
    else:
        method = input('''   
            1 = Up
            2 = Down
            5 = Main Menu
            6 = Exit
            ''')
    if method == '1':
        f.writing("Response: 1 - Up\n")
        insert_vote(table, 'up', id)
    elif method == '2':
        f.writing("Response: 2 - Down\n")
        insert_vote(table, 'down', id)
    elif method == '3':
        f.writing("Response: 3 - Delete Up\n")
        delete_vote(table, 'up', id)
    elif method == '4':
        f.writing("Response: 4 - Delete Down\n")
        delete_vote(table, 'down', id)
    elif method == '6':
        f.writing("Response: 6 - Exit")
        exit()
    else:
        f.writing("Response: 5 - Main Menu")
        main_menu()
예제 #3
0
def show_votes(table, id):
    if table == 'comment':
        up = cu.read_all(id)
    else:
        up = pu.read_all(id)
    print("Upvotes:")
    print(up)
    if table == 'comment':
        down = cd.read_all(id)
    else:
        down = pd.read_all(id)
    print("Downvotes:")
    print(down)
    print("-" * 40)
    print("                Vote Menu")
    print("-" * 40)
    if admin == True:
        method = input('''   
            1 = Up
            2 = Down
            3 = Delete Up
            4 = Delete Down
            5 = Main Menu
            6 = Exit
            ''')
    else:
        method = input('''   
            1 = Up
            2 = Down
            5 = Main Menu
            6 = Exit
            ''')
    if method == '1':
        insert_vote(table, 'up', id)
    elif method == '2':
        insert_vote(table, 'down', id)
    elif method == '3':
        delete_vote(table, 'up', id)
    elif method == '4':
        delete_vote(table, 'down', id)
    elif method == '6':
        exit()
    else:
        main_menu()