|
|
@ -184,7 +184,7 @@ def get_row(ident):
|
|
|
|
@authenticate
|
|
|
|
@authenticate
|
|
|
|
def update_row(ident, editor=None):
|
|
|
|
def update_row(ident, editor=None):
|
|
|
|
new_row = flask.request.json
|
|
|
|
new_row = flask.request.json
|
|
|
|
override_changes = 'override_changes' in new_row
|
|
|
|
override_changes = new_row.get('override_changes', False)
|
|
|
|
"""Updates row of database with id = ident with the edit columns in
|
|
|
|
"""Updates row of database with id = ident with the edit columns in
|
|
|
|
new_row."""
|
|
|
|
new_row."""
|
|
|
|
|
|
|
|
|
|
|
@ -193,8 +193,9 @@ def update_row(ident, editor=None):
|
|
|
|
non_null_columns = ['upload_location', 'video_start', 'video_end',
|
|
|
|
non_null_columns = ['upload_location', 'video_start', 'video_end',
|
|
|
|
'video_channel', 'video_quality', 'video_title', 'video_description', 'video_tags']
|
|
|
|
'video_channel', 'video_quality', 'video_title', 'video_description', 'video_tags']
|
|
|
|
edit_columns = non_null_columns + ['allow_holes', 'uploader_whitelist']
|
|
|
|
edit_columns = non_null_columns + ['allow_holes', 'uploader_whitelist']
|
|
|
|
sheet_columns = ['sheet_name', 'event_start', 'event_end', 'category',
|
|
|
|
sheet_columns = [
|
|
|
|
'description', 'notes']
|
|
|
|
'sheet_name', 'event_start', 'event_end', 'category', 'description', 'notes'
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
#check vital edit columns are in new_row
|
|
|
|
#check vital edit columns are in new_row
|
|
|
|
wanted = set(non_null_columns + ['state'] + sheet_columns)
|
|
|
|
wanted = set(non_null_columns + ['state'] + sheet_columns)
|
|
|
@ -224,8 +225,10 @@ def update_row(ident, editor=None):
|
|
|
|
built_query = sql.SQL("""
|
|
|
|
built_query = sql.SQL("""
|
|
|
|
SELECT id, state, {}
|
|
|
|
SELECT id, state, {}
|
|
|
|
FROM events
|
|
|
|
FROM events
|
|
|
|
WHERE id = %s""").format(sql.SQL(', ').join(
|
|
|
|
WHERE id = %s
|
|
|
|
sql.Identifier(key) for key in sheet_columns))
|
|
|
|
""").format(sql.SQL(', ').join(
|
|
|
|
|
|
|
|
sql.Identifier(key) for key in sheet_columns
|
|
|
|
|
|
|
|
))
|
|
|
|
results = database.query(conn, built_query, ident)
|
|
|
|
results = database.query(conn, built_query, ident)
|
|
|
|
old_row = results.fetchone()._asdict()
|
|
|
|
old_row = results.fetchone()._asdict()
|
|
|
|
if old_row is None:
|
|
|
|
if old_row is None:
|
|
|
|