fix: 504 return code and relay_schedule junction
This commit is contained in:
parent
c370ab6fea
commit
6050f1cc5f
2 changed files with 14 additions and 16 deletions
models
|
@ -17,12 +17,6 @@ db_update_insert(relay_t *relay, sqlite3_stmt *stmt)
|
|||
{
|
||||
int rc;
|
||||
|
||||
junction_relay_schedule_remove_for_relay(relay->id);
|
||||
for(int i = 0; i < 7; ++i)
|
||||
{
|
||||
junction_relay_schedule_insert(i, relay->id, relay->schedules[i]->id);
|
||||
}
|
||||
|
||||
sqlite3_bind_int(stmt, 1, relay->id);
|
||||
sqlite3_bind_int(stmt, 2, relay->number);
|
||||
sqlite3_bind_text(stmt, 3, relay->name, -1, SQLITE_STATIC);
|
||||
|
@ -142,8 +136,18 @@ relay_save(relay_t *relay)
|
|||
}
|
||||
else
|
||||
{
|
||||
relay->id = sqlite3_last_insert_rowid(global_database);
|
||||
if(relay->id == 0)
|
||||
{
|
||||
relay->id = sqlite3_last_insert_rowid(global_database);
|
||||
}
|
||||
}
|
||||
|
||||
junction_relay_schedule_remove_for_relay(relay->id);
|
||||
for(int i = 0; i < 7; ++i)
|
||||
{
|
||||
junction_relay_schedule_insert(i, relay->id, relay->schedules[i]->id);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue