From 2b446a5fd5d8f9b8c0f1e3acef1eef7ad9adb6f9 Mon Sep 17 00:00:00 2001 From: tj <1378534974@qq.com> Date: 星期三, 09 四月 2025 10:25:27 +0800 Subject: [PATCH] 1.1 --- app/src/main/java/com/example/firstapp/ui/dashboard/DashboardViewModel.kt | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/firstapp/ui/dashboard/DashboardViewModel.kt b/app/src/main/java/com/example/firstapp/ui/dashboard/DashboardViewModel.kt index c2c0fc9..1a0a2cb 100644 --- a/app/src/main/java/com/example/firstapp/ui/dashboard/DashboardViewModel.kt +++ b/app/src/main/java/com/example/firstapp/ui/dashboard/DashboardViewModel.kt @@ -4,6 +4,7 @@ import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.asLiveData import androidx.lifecycle.viewModelScope +import androidx.room.RewriteQueriesToDropUnusedColumns import com.example.firstapp.AppDatabase import com.example.firstapp.database.entity.Code import com.example.firstapp.database.repository.CodeRepository @@ -21,11 +22,29 @@ fun getPackages(date: Long, dateType: String) = repository.getPackages(date, dateType).asLiveData() - fun getCourierStats(date: Long) = repository.getCourierStats(date).asLiveData() + fun getCourierStats(date: Long, dateType: String) = + repository.getCourierStats(date, dateType).asLiveData() - fun getDailyStats(date: Long) = repository.getDailyStats(date).asLiveData() + fun getYearlyHeatmap(date: Long) = repository.getYearlyHeatmap(date).asLiveData() + + + fun getWeeklyStats(date: Long, weekCount: Int = 6) = + repository.getWeeklyStats(date, weekCount).asLiveData() + + fun getMonthlyStats(date: Long) = repository.getMonthlyStats(date).asLiveData() + + fun getYearlyStats(date: Long) = repository.getYearlyStats(date).asLiveData() + + fun getYearMonthlyStats(date: Long) = + repository.getYearMonthlyStats(date).asLiveData() fun insert(code: Code) = viewModelScope.launch { repository.insert(code) } + + fun getCurrentWeekStats(date: Long) = + repository.getCurrentWeekStats(date).asLiveData() + + fun getCurrentYearStats(date: Long) = + repository.getCurrentYearStats(date).asLiveData() } \ No newline at end of file -- Gitblit v1.9.3