Skip to content

Commit

Permalink
address remaining comments and unit all view models
Browse files Browse the repository at this point in the history
  • Loading branch information
eldcn committed Aug 25, 2024
1 parent 8f9bfee commit 2755855
Show file tree
Hide file tree
Showing 25 changed files with 498 additions and 210 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class HealthPageTest {
id = entryId,
)
),
valueFormatter = { value, _ -> "$value" }
valueFormatter = { value -> "$value" }
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private fun InfoRow(
onClick = onInfoAction
) {
Icon(
Icons.Filled.Info,
imageVector = Icons.Filled.Info,

Check warning on line 184 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthPage.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthPage.kt#L184

Added line #L184 was not covered by tests
contentDescription = stringResource(R.string.info_icon_content_description),
tint = primary

Check warning on line 186 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthPage.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthPage.kt#L186

Added line #L186 was not covered by tests
)
Expand Down Expand Up @@ -209,7 +209,7 @@ private class HealthPagePreviewProvider : PreviewParameterProvider<HealthUiState
HealthUiState.NoData("No data available"),
HealthUiState.Success(
data = HealthUiData(
valueFormatter = { _, _ -> "Jan 24" },
valueFormatter = { "Jan 24" },

Check warning on line 212 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthPage.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthPage.kt#L212

Added line #L212 was not covered by tests
infoRowData = InfoRowData(
selectedTimeRange = TimeRange.MONTHLY,
formattedValue = "70.0 kg",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class HealthRepository @Inject constructor(
logger.e(error) { "Error listening for latest observation in collection: ${collection.name}" }
trySend(Result.failure(error))
} else {
val documents = snapshot?.documents
val records: List<T> = documents?.mapNotNull { document ->
val records: List<T> = snapshot?.documents?.mapNotNull { document ->
observationsDocumentMapper.map(document)
} ?: emptyList()
trySend(Result.success(records))
Expand All @@ -79,11 +78,6 @@ class HealthRepository @Inject constructor(
suspend fun observeHeartRateRecords(): Flow<Result<List<HeartRateRecord>>> =
observe(ObservationCollection.HEART_RATE)

companion object {
const val DEFAULT_MAX_MONTHS = 6L
const val DATE_TIME_FIELD = "effectiveDateTime"
}

suspend fun saveRecord(record: Record): Result<Unit> {
val observations = recordToObservationMapper.map(record)
return withContext(ioDispatcher) {
Expand All @@ -99,11 +93,7 @@ class HealthRepository @Inject constructor(
batch.set(docRef, data)

Check warning on line 93 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthRepository.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthRepository.kt#L93

Added line #L93 was not covered by tests
}
}
batch.commit().await()
}.map {
Result.success(Unit)
}.getOrElse {
Result.failure(it)
batch.commit().await().let { }

Check warning on line 96 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthRepository.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthRepository.kt#L96

Added line #L96 was not covered by tests
}
}
}
Expand All @@ -115,11 +105,7 @@ class HealthRepository @Inject constructor(
return withContext(ioDispatcher) {
runCatching {
observationCollectionProvider.getCollection(observationCollection)
.document(recordId).delete().await()
}.map {
Result.success(Unit)
}.getOrElse {
Result.failure(it)
.document(recordId).delete().await().let { }

Check warning on line 108 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthRepository.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthRepository.kt#L105-L108

Added lines #L105 - L108 were not covered by tests
}
}
}
Expand All @@ -135,4 +121,9 @@ class HealthRepository @Inject constructor(
suspend fun deleteHeartRateRecord(recordId: String): Result<Unit> {

Check warning on line 121 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthRepository.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthRepository.kt#L121

Added line #L121 was not covered by tests
return deleteRecord(recordId, ObservationCollection.HEART_RATE)
}

companion object {
const val DEFAULT_MAX_MONTHS = 6L
const val DATE_TIME_FIELD = "effectiveDateTime"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data class HealthUiData(
val newestData: NewestHealthData? = null,
val averageData: AverageHealthData? = null,
val infoRowData: InfoRowData,
val valueFormatter: (Float, TimeRange) -> String,
val valueFormatter: (Float) -> String,
) {
val selectedTimeRange = infoRowData.selectedTimeRange
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ class HealthUiStateMapper @Inject constructor(
selectedTimeRange: TimeRange,
): HealthUiState {
val engageRecords = records.map { EngageRecord.from(it) }
val filteredRecords = engageRecords
.filter {
it.zonedDateTime.isAfter(
ZonedDateTime.now().minusMonths(getMaxMonths(selectedTimeRange))
)
}
return if (filteredRecords.isEmpty()) {
return if (engageRecords.isEmpty()) {
HealthUiState.NoData(message = "No data available")
} else {
HealthUiState.Success(
Expand Down Expand Up @@ -76,7 +75,7 @@ class HealthUiStateMapper @Inject constructor(
newestData = newestData,
averageData = getAverageData(tableData),
infoRowData = generateHealthHeaderData(selectedTimeRange, newestData),
valueFormatter = ::valueFormatter
valueFormatter = { valueFormatter(it, selectedTimeRange) }
)
}

Expand Down Expand Up @@ -317,16 +316,39 @@ class HealthUiStateMapper @Inject constructor(

private fun getDefaultLocale() = localeProvider.getDefaultLocale()

companion object {
private const val DAILY_MAX_MONTHS = 1L
private const val WEEKLY_MAX_MONTHS = 3L
private const val MONTHLY_MAX_MONTHS = 6L
private fun valueFormatter(value: Float, timeRange: TimeRange): String {
val date = when (timeRange) {
TimeRange.DAILY -> {
val actualValue = value * 10
val year = actualValue.toInt()
val dayOfYearFraction = actualValue - year
val dayOfYear = (dayOfYearFraction * 365).toInt() + 1
ZonedDateTime.of(year, 1, 1, 0, 0, 0, 0, ZoneId.systemDefault())
.plusDays((dayOfYear - 1).toLong())

Check warning on line 327 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthUiStateMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthUiStateMapper.kt#L322-L327

Added lines #L322 - L327 were not covered by tests
}

const val EPOCH_SECONDS_DIVISOR = 60.0f
const val ADAPTIVE_Y_VALUES_FRACTION = 1.05f
TimeRange.WEEKLY -> ZonedDateTime.ofInstant(
Instant.ofEpochSecond(
value.toLong() * 7 * 24 * 60 * 60
), ZoneId.systemDefault()

Check warning on line 333 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthUiStateMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthUiStateMapper.kt#L330-L333

Added lines #L330 - L333 were not covered by tests
)

private const val MONTH_DAY_TIME_PATTERN = "MMM dd HH:mm"
private const val MONTH_YEAR_PATTERN = "MMM yy"
TimeRange.MONTHLY -> {
val year = value.toInt()
val month = ((value - year) * 12).toInt() + 1
ZonedDateTime.of(year, month, 1, 0, 0, 0, 0, ZoneId.systemDefault())

Check warning on line 339 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthUiStateMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthUiStateMapper.kt#L337-L339

Added lines #L337 - L339 were not covered by tests
}
}
val pattern = when (timeRange) {
TimeRange.DAILY, TimeRange.WEEKLY -> "MMM dd"
TimeRange.MONTHLY -> "MMM yy"

Check warning on line 344 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthUiStateMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthUiStateMapper.kt#L343-L344

Added lines #L343 - L344 were not covered by tests
}
return date.format(DateTimeFormatter.ofPattern(pattern))

Check warning on line 346 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthUiStateMapper.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/HealthUiStateMapper.kt#L346

Added line #L346 was not covered by tests
}

@Suppress("MagicNumber")
private fun Float.roundToTwoDecimalPlaces(): Float {
return Math.round(this * 100) / 100.0f
}

private data class ValueUnit(val value: Double, val unit: String)
Expand Down Expand Up @@ -357,38 +379,15 @@ class HealthUiStateMapper @Inject constructor(
}
}

private fun valueFormatter(value: Float, timeRange: TimeRange): String {
val date = when (timeRange) {
TimeRange.DAILY -> {
val year = (value * 10).toInt()
val dayOfYearFraction = (value * 10) - year
val dayOfYear = (dayOfYearFraction * 365).toInt() + 1
ZonedDateTime.of(year, 1, 1, 0, 0, 0, 0, ZoneId.systemDefault())
.plusDays((dayOfYear - 1).toLong())
}
companion object {
private const val DAILY_MAX_MONTHS = 1L
private const val WEEKLY_MAX_MONTHS = 3L
private const val MONTHLY_MAX_MONTHS = 6L

TimeRange.WEEKLY -> ZonedDateTime.ofInstant(
Instant.ofEpochSecond(
value.toLong() * 7 * 24 * 60 * 60
), ZoneId.systemDefault()
)
const val EPOCH_SECONDS_DIVISOR = 60.0f
const val ADAPTIVE_Y_VALUES_FRACTION = 1.05f

TimeRange.MONTHLY -> {
val year = value.toInt()
val month = ((value - year) * 12).toInt() + 1
ZonedDateTime.of(year, month, 1, 0, 0, 0, 0, ZoneId.systemDefault())
}
}
val pattern = when (timeRange) {
TimeRange.WEEKLY -> "MMM dd"
TimeRange.MONTHLY -> "MMM yy"
TimeRange.DAILY -> "MMM dd"
}
return date.format(DateTimeFormatter.ofPattern(pattern))
private const val MONTH_DAY_TIME_PATTERN = "MMM dd HH:mm"
private const val MONTH_YEAR_PATTERN = "MMM yy"
}
}

@Suppress("MagicNumber")
private fun Float.roundToTwoDecimalPlaces(): Float {
return Math.round(this * 100) / 100.0f
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
Expand All @@ -17,7 +16,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import edu.stanford.bdh.engagehf.R
import edu.stanford.bdh.engagehf.health.components.AddDataHeader
Expand Down Expand Up @@ -74,7 +72,6 @@ private fun AddBloodPressureBottomSheet(
horizontalArrangement = Arrangement.Center

Check warning on line 72 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/bloodpressure/bottomsheet/AddBloodPressureBottomSheet.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/bloodpressure/bottomsheet/AddBloodPressureBottomSheet.kt#L68-L72

Added lines #L68 - L72 were not covered by tests
) {
NumberPicker(

Check warning on line 74 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/bloodpressure/bottomsheet/AddBloodPressureBottomSheet.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/bloodpressure/bottomsheet/AddBloodPressureBottomSheet.kt#L74

Added line #L74 was not covered by tests
modifier = Modifier.size(height = 110.dp, width = 70.dp),
value = uiState.systolic,
onValueChange = {
onAction(AddBloodPressureBottomSheetViewModel.Action.UpdateSystolic(it))
Expand All @@ -83,7 +80,6 @@ private fun AddBloodPressureBottomSheet(
)
Text(text = " / ", style = TextStyles.bodyLarge)
NumberPicker(

Check warning on line 82 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/bloodpressure/bottomsheet/AddBloodPressureBottomSheet.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/bloodpressure/bottomsheet/AddBloodPressureBottomSheet.kt#L81-L82

Added lines #L81 - L82 were not covered by tests
modifier = Modifier.size(height = 110.dp, width = 70.dp),
value = uiState.diastolic,
onValueChange = {
onAction(AddBloodPressureBottomSheetViewModel.Action.UpdateDiastolic(it))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ data class AddBloodPressureBottomSheetUiState(
val isUpdateDateExpanded: Boolean = false,
val isUpdateTimeExpanded: Boolean = false,
val bodyPosition: BodyPositions = BodyPositions.BODY_POSITION_UNKNOWN,
val bodyPositions: List<BodyPositions> = BodyPositions.entries,
val isBodyPositionsDialogShown: Boolean = false,
val measurementLocation: MeasurementLocations = MeasurementLocations.MEASUREMENT_LOCATION_UNKNOWN,
val measurementLocations: List<MeasurementLocations> = MeasurementLocations.entries,
val isMeasurementLocationsDialogShown: Boolean = false,
) {
val bodyPositions: List<BodyPositions> = BodyPositions.entries
val measurementLocations: List<MeasurementLocations> = MeasurementLocations.entries

@Suppress("MagicNumber")

Check warning on line 21 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/bloodpressure/bottomsheet/AddBloodPressureBottomSheetUiState.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/bloodpressure/bottomsheet/AddBloodPressureBottomSheetUiState.kt#L21

Added line #L21 was not covered by tests
val systolicRange = 0..200 // 200 is the maximum value for systolic blood pressure record

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package edu.stanford.bdh.engagehf.health.bloodpressure.bottomsheet

import edu.stanford.spezi.core.utils.DateTimeFormatter
import edu.stanford.bdh.engagehf.utils.DateTimeFormatter
import java.time.LocalDate
import java.time.LocalTime
import javax.inject.Inject
Expand All @@ -10,14 +10,16 @@ class AddBloodPressureBottomSheetUiStateMapper @Inject constructor(
) {

fun initialUiState(): AddBloodPressureBottomSheetUiState {
val localDate = LocalDate.now()
val localTime = LocalTime.now()
return AddBloodPressureBottomSheetUiState(
timePickerState = TimePickerState(
selectedDate = LocalDate.now(),
selectedTime = LocalTime.now(),
initialHour = LocalTime.now().hour,
initialMinute = LocalTime.now().minute,
selectedDateFormatted = dateTimeFormatter.format(LocalDate.now()),
selectedTimeFormatted = dateTimeFormatter.format(LocalTime.now())
selectedDate = localDate,
selectedTime = localTime,
initialHour = localTime.hour,
initialMinute = localTime.minute,
selectedDateFormatted = dateTimeFormatter.format(localDate),
selectedTimeFormatted = dateTimeFormatter.format(localTime)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fun HealthChart(
)

val valueFormatter: (Float, ChartValues, AxisPosition.Vertical?) -> CharSequence =
{ value, _, _ -> uiState.valueFormatter(value, uiState.selectedTimeRange) }
{ value, _, _ -> uiState.valueFormatter(value) }

Check warning on line 87 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/components/HealthChart.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/components/HealthChart.kt#L86-L87

Added lines #L86 - L87 were not covered by tests

val marker = remember {
DefaultCartesianMarker(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import edu.stanford.spezi.core.design.theme.Colors
import edu.stanford.spezi.core.design.theme.Spacings
Expand All @@ -24,16 +25,18 @@ import edu.stanford.spezi.core.design.theme.TextStyles
import edu.stanford.spezi.core.design.theme.ThemePreviews
import kotlinx.coroutines.launch

private val PICKER_SIZE = DpSize(height = 110.dp, width = 70.dp)

Check warning on line 28 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/components/NumberPicker.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/components/NumberPicker.kt#L28

Added line #L28 was not covered by tests

@Composable
fun NumberPicker(
value: Int,
onValueChange: (Int) -> Unit,
range: IntRange,
modifier: Modifier = Modifier,
size: DpSize = PICKER_SIZE,

Check warning on line 35 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/components/NumberPicker.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/components/NumberPicker.kt#L35

Added line #L35 was not covered by tests
) {
val lazyListState = rememberLazyListState(initialFirstVisibleItemIndex = value - 1)

Check warning on line 37 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/components/NumberPicker.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/components/NumberPicker.kt#L37

Added line #L37 was not covered by tests

Box(modifier = modifier, contentAlignment = Alignment.Center) {
Box(modifier = Modifier.size(size), contentAlignment = Alignment.Center) {
LazyColumn(
state = lazyListState,
modifier = Modifier.fillMaxSize(),
Expand Down Expand Up @@ -75,7 +78,6 @@ fun NumberPickerPreview() {
value = 5,
onValueChange = {},
range = 0..10,

Check warning on line 80 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/components/NumberPicker.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/components/NumberPicker.kt#L78-L80

Added lines #L78 - L80 were not covered by tests
modifier = Modifier.size(height = 110.dp, width = 70.dp),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -18,7 +17,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import edu.stanford.bdh.engagehf.R
import edu.stanford.bdh.engagehf.health.bloodpressure.bottomsheet.TimePickerState
Expand Down Expand Up @@ -77,7 +75,6 @@ private fun AddHeartRateBottomSheet(
horizontalArrangement = Arrangement.Center

Check warning on line 75 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/heartrate/bottomsheet/AddHeartRateBottomSheet.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/heartrate/bottomsheet/AddHeartRateBottomSheet.kt#L71-L75

Added lines #L71 - L75 were not covered by tests
) {
NumberPicker(

Check warning on line 77 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/heartrate/bottomsheet/AddHeartRateBottomSheet.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/heartrate/bottomsheet/AddHeartRateBottomSheet.kt#L77

Added line #L77 was not covered by tests
modifier = Modifier.size(height = 110.dp, width = 70.dp),
value = uiState.heartRate,
onValueChange = {
onAction(AddHeartRateBottomSheetViewModel.Action.UpdateHeartRate(it))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package edu.stanford.bdh.engagehf.health.heartrate.bottomsheet

import edu.stanford.bdh.engagehf.health.bloodpressure.bottomsheet.TimePickerState
import edu.stanford.spezi.core.utils.DateTimeFormatter
import edu.stanford.bdh.engagehf.utils.DateTimeFormatter
import java.time.LocalDate
import java.time.LocalTime
import javax.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -18,7 +17,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import edu.stanford.bdh.engagehf.R
import edu.stanford.bdh.engagehf.health.bloodpressure.bottomsheet.TimePickerState
Expand Down Expand Up @@ -91,7 +89,6 @@ fun AddWeightBottomSheet(
horizontalArrangement = Arrangement.Center

Check warning on line 89 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/weight/bottomsheet/AddWeightBottomSheet.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/weight/bottomsheet/AddWeightBottomSheet.kt#L85-L89

Added lines #L85 - L89 were not covered by tests
) {
NumberPicker(

Check warning on line 91 in app/src/main/kotlin/edu/stanford/bdh/engagehf/health/weight/bottomsheet/AddWeightBottomSheet.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/edu/stanford/bdh/engagehf/health/weight/bottomsheet/AddWeightBottomSheet.kt#L91

Added line #L91 was not covered by tests
modifier = Modifier.size(height = 110.dp, width = 70.dp),
value = uiState.weight.toInt(),
onValueChange = {
onAction(AddWeightBottomSheetViewModel.Action.UpdateWeight(it.toDouble()))
Expand Down
Loading

0 comments on commit 2755855

Please sign in to comment.