Skip to content

Commit

Permalink
fix codestyle/readability
Browse files Browse the repository at this point in the history
  • Loading branch information
newhinton committed Sep 15, 2024
1 parent 87d64f7 commit c35f3f9
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ class DatabaseHandler(context: Context?) :

fun createTask(taskToStore: Task, withId: Boolean = false): Task {
val db = writableDatabase
val newRowId = db.insert(Task.TABLE_NAME, null, if(withId) getTaskContentValuesWithID(taskToStore) else getTaskContentValues(taskToStore))
val values = if(withId) {
getTaskContentValuesWithID(taskToStore)
} else {
getTaskContentValues(taskToStore)
}
val newRowId = db.insert(Task.TABLE_NAME, null, values)
db.close()
taskToStore.id = newRowId
return taskToStore
Expand Down Expand Up @@ -233,7 +238,12 @@ class DatabaseHandler(context: Context?) :

fun createTrigger(triggerToStore: Trigger, withId: Boolean = false): Trigger {
val db = writableDatabase
val newRowId = db.insert(Trigger.TABLE_NAME, null, if(withId) getTriggerContentValuesWithID(triggerToStore) else getTriggerContentValues(triggerToStore))
val values = if(withId) {
getTriggerContentValuesWithID(triggerToStore)
} else {
getTriggerContentValues(triggerToStore)
}
val newRowId = db.insert(Trigger.TABLE_NAME, null, values)
db.close()
triggerToStore.id = newRowId
return triggerToStore
Expand Down

0 comments on commit c35f3f9

Please sign in to comment.