From 5ec779be489af76e47113a8cd159f79465b10005 Mon Sep 17 00:00:00 2001 From: Sufyan Abbasi Date: Mon, 26 Feb 2024 15:02:56 -0800 Subject: [PATCH] Cleanup condition logging. --- .../java/com/google/android/ground/model/task/Condition.kt | 3 --- .../remote/firebase/schema/ConditionConverter.kt | 5 +---- .../persistence/remote/firebase/schema/TaskConverter.kt | 1 - .../ground/ui/datacollection/DataCollectionViewModel.kt | 7 ------- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/ground/src/main/java/com/google/android/ground/model/task/Condition.kt b/ground/src/main/java/com/google/android/ground/model/task/Condition.kt index 3c944ee4b1..6805f01979 100644 --- a/ground/src/main/java/com/google/android/ground/model/task/Condition.kt +++ b/ground/src/main/java/com/google/android/ground/model/task/Condition.kt @@ -15,8 +15,6 @@ */ package com.google.android.ground.model.task -import timber.log.Timber - /** The task ID. */ typealias TaskId = String /** The selected option ID for each task. */ @@ -47,7 +45,6 @@ constructor( /** Given the user's task selections, determine whether the condition is fulfilled. */ fun fulfilledBy(taskSelections: TaskSelections): Boolean { - Timber.v("taskSelections: %s", taskSelections) return when (matchType) { MatchType.MATCH_ANY -> expressions.any { it.fulfilledBy(taskSelections) } MatchType.MATCH_ALL -> expressions.all { it.fulfilledBy(taskSelections) } diff --git a/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/ConditionConverter.kt b/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/ConditionConverter.kt index e69c60cb5d..89a066f5a1 100644 --- a/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/ConditionConverter.kt +++ b/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/ConditionConverter.kt @@ -53,14 +53,11 @@ internal object ConditionConverter { } else if (it.taskId == null) { Timber.e("Empty task ID encountered, skipping expression.") null - } else if (it.optionIds == null) { - Timber.e("Empty option IDs encountered, skipping expression.") - null } else { Expression( expressionType = expressionType, taskId = it.taskId, - optionIds = it.optionIds.toSet(), + optionIds = it.optionIds?.toSet() ?: setOf(), ) } } diff --git a/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/TaskConverter.kt b/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/TaskConverter.kt index b8c58ac967..3125cb6749 100644 --- a/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/TaskConverter.kt +++ b/ground/src/main/java/com/google/android/ground/persistence/remote/firebase/schema/TaskConverter.kt @@ -35,7 +35,6 @@ internal object TaskConverter { // Default index to -1 to degrade gracefully on older dev db instances and surveys. val multipleChoice: MultipleChoice? = if (type == Task.Type.MULTIPLE_CHOICE) toMultipleChoice(em) else null - Timber.v("task condition: ", em.condition) return Task( id, em.index ?: -1, diff --git a/ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionViewModel.kt b/ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionViewModel.kt index 0f9f63d732..fb70e9d8f7 100644 --- a/ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionViewModel.kt +++ b/ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionViewModel.kt @@ -207,7 +207,6 @@ class DataCollectionViewModel tasks.subList(startIndex, tasks.size) }.let { tasks -> tasks.asSequence().filter { - Timber.v("condition: %s", it.condition) it.condition == null || evaluateCondition(it.condition) } } @@ -216,17 +215,11 @@ class DataCollectionViewModel /** Displays the task at the relative position to the current one. Supports negative steps. */ fun step(stepCount: Int) { val reverse = stepCount < 0 - Timber.v( - "current: %s, reverse: %s, tasks: %s", - currentTaskId.value, - reverse, - tasks.map { it.id }) val task = getTaskSequence( startId = currentTaskId.value, preceding = reverse ).take(Math.abs(stepCount) + 1).last() savedStateHandle[TASK_POSITION_ID] = task.id - Timber.v("next: %s", task.id) } /** Returns true if the given task index is last if set, or the current active task. */