Add default timestamp argument to dao methods

pull/1012/head
Alex Baker 4 years ago
parent 998d07d34e
commit 6487180e38

@ -130,7 +130,7 @@ class CaldavDaoTests : InjectingTestCase() {
val caldavAccount = CaldavAccount()
caldavAccount.uuid = UUIDHelper.newUUID()
caldavDao.insert(caldavAccount)
assertTrue(caldavDao.getCaldavFilters(caldavAccount.uuid!!, DateUtilities.now()).isEmpty())
assertTrue(caldavDao.getCaldavFilters(caldavAccount.uuid!!).isEmpty())
}
private fun checkOrder(dateTime: DateTime, task: Long) = checkOrder(dateTime.toAppleEpoch(), task)

@ -2,7 +2,6 @@ package org.tasks.data
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.natpryce.makeiteasy.MakeItEasy.with
import com.todoroo.andlib.utility.DateUtilities.now
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith
@ -24,7 +23,7 @@ class GoogleTaskListDaoTest : InjectingTestCase() {
account.account = "user@gmail.com"
googleTaskListDao.insert(account)
assertTrue(googleTaskListDao.getGoogleTaskFilters(account.account!!, now()).isEmpty())
assertTrue(googleTaskListDao.getGoogleTaskFilters(account.account!!).isEmpty())
}
@Test

@ -175,7 +175,7 @@ abstract class CaldavDao {
+ " LEFT JOIN tasks ON caldav_tasks.cd_task = tasks._id AND tasks.deleted = 0 AND tasks.completed = 0 AND tasks.hideUntil < :now AND cd_deleted = 0"
+ " WHERE caldav_lists.cdl_account = :uuid"
+ " GROUP BY caldav_lists.cdl_uuid")
abstract fun getCaldavFilters(uuid: String, now: Long): List<CaldavFilters>
abstract fun getCaldavFilters(uuid: String, now: Long = currentTimeMillis()): List<CaldavFilters>
@Query("SELECT tasks._id FROM tasks "
+ "INNER JOIN tags ON tags.task = tasks._id "

@ -4,6 +4,7 @@ import androidx.lifecycle.LiveData
import androidx.room.*
import io.reactivex.Single
import org.tasks.filters.GoogleTaskFilters
import org.tasks.time.DateTimeUtils.currentTimeMillis
@Dao
interface GoogleTaskListDao {
@ -61,5 +62,5 @@ interface GoogleTaskListDao {
+ " LEFT JOIN tasks ON google_tasks.gt_task = tasks._id AND tasks.deleted = 0 AND tasks.completed = 0 AND tasks.hideUntil < :now AND gt_deleted = 0"
+ " WHERE google_task_lists.gtl_account = :account"
+ " GROUP BY google_task_lists.gtl_remote_id")
fun getGoogleTaskFilters(account: String, now: Long): List<GoogleTaskFilters>
fun getGoogleTaskFilters(account: String, now: Long = currentTimeMillis()): List<GoogleTaskFilters>
}

@ -244,7 +244,7 @@ class FilterProvider @Inject constructor(
emptyList()
} else {
googleTaskListDao
.getGoogleTaskFilters(account.account!!, DateUtilities.now())
.getGoogleTaskFilters(account.account!!)
.map(GoogleTaskFilters::toGtasksFilter)
.sortedWith(AlphanumComparator.FILTER)
}
@ -266,7 +266,7 @@ class FilterProvider @Inject constructor(
emptyList()
} else {
caldavDao
.getCaldavFilters(account.uuid!!, DateUtilities.now())
.getCaldavFilters(account.uuid!!)
.map(CaldavFilters::toCaldavFilter)
.sortedWith(AlphanumComparator.FILTER)
}

Loading…
Cancel
Save