forked from CodecoolBase/ask-mate-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.py
More file actions
34 lines (24 loc) · 943 Bytes
/
util.py
File metadata and controls
34 lines (24 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import connection
import time
import database_connection
def define_table_headers():
table_headers = [['Submission Time', 'View number', 'Vote number', 'Title', 'Message'],
['Submission Time', 'Vote number', 'Message','Edit', 'Delete', 'Post Comment', 'Existing Comments'],
['Submission Time', 'Message', 'Edit', 'Delete'],
['Name', 'Username', 'Date of registration']]
return table_headers
@database_connection.connection_handler
def generate_id(cursor):
cursor.execute("""
SELECT id FROM question
ORDER BY id DESC
LIMIT 1
""")
id = cursor.fetchall()
return id
def add_submission_time():
return int(time.time())
def get_latest_question_id():
questions = []
connection.read_data_from_csv("templates/question.csv", questions)
return questions[-1]["id"]