fixes in response to review

pull/195/head
Christopher Usher 4 years ago
parent b21a520d3a
commit 27c6b70976

@ -275,8 +275,7 @@ thrimbletrimmerSubmit = function(state, override_changes=false) {
//Submit to thrimshim
var rowId = /id=(.*)(?:&|$)/.exec(document.location.search)[1];
path = "/thrimshim/" + rowId + "?override_changes=" + override_changes;
fetch(path, {
fetch("/thrimshim/" + rowId, {
method: 'POST',
headers: {
'Accept': 'application/json',

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

Loading…
Cancel
Save