def error_log(last_log, **params): spreadsheetId = params["spreadsheetId"] output_spreadsheet = params["output_spreadsheet"] offset = params["offset"] tab = params["tab"] out = params["out"] if last_log.status == "Error": last_log.updated_row += 1 last_log.save() else: last_log = Log(from_sheet=spreadsheetId, to_sheet=output_spreadsheet, from_tab=tab, to_tab=out) last_log.updated_range = '!A{}:M'.format(offset) last_log.updated_row = 1 last_log.updated_col = 0 last_log.status = "Error" last_log.save() return last_log
def success_log(last_log, **params): spreadsheetId = params["spreadsheetId"] output_spreadsheet = params["output_spreadsheet"] tab = params["tab"] out = params["out"] body = params["body"] if last_log.status == "Success": last_log.updated_row += 1 last_log.save() else: last_log = Log(from_sheet=spreadsheetId, to_sheet=output_spreadsheet, from_tab=tab, to_tab=out) last_log.updated_range = body["updatedRange"] last_log.updated_row = body["updatedRows"] last_log.updated_col = body["updatedColumns"] last_log.status = "Success" last_log.save() return last_log