Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs #330

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@ class DatabaseUtils(val context: Context) : SQLiteOpenHelper(context, DATABASE_N
}

// DELETE OPERATIONS
fun deleteAlarm(id: Int): Int {
fun deleteAlarm(habitId: Int): Int {
val db = writableDatabase
return db.delete(TABLE_ALARM, "$COLUMN_ID = ?", arrayOf(id.toString()))
return db.delete(TABLE_ALARM, "$COLUMN_HABIT_ID = ?", arrayOf(habitId.toString()))
}

fun deleteHabit(id: Int?): Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class HabitsBottomSheetDialog(
binding.btnDecDoneCount.setOnClickListener()
{

if (habit.countAvoided > 0) {
if (habit.countDone > 0) {
habit.countDone--
dbHelper.updateHabit(habit)
//delete the last row where status is avoided
Expand Down Expand Up @@ -285,7 +285,7 @@ class HabitsBottomSheetDialog(
context,
habitId,
intent,
PendingIntent.FLAG_UPDATE_CURRENT
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
)
alarmManager.cancel(pendingIntent)

Expand Down