Skip to content

Commit 1e51636

Browse files
committed
updates
1 parent cfda014 commit 1e51636

File tree

8 files changed

+11
-21
lines changed

8 files changed

+11
-21
lines changed

src/app/src/androidTest/java/com/couchbase/learningpath/DatabaseIntegrationTests.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,11 @@ import com.couchbase.learningpath.data.audits.AuditRepositoryDb
99
import com.couchbase.learningpath.data.project.ProjectRepositoryDb
1010
import com.couchbase.learningpath.data.stockItem.StockItemRepositoryDb
1111
import com.couchbase.learningpath.data.userprofile.UserProfileRepository
12-
import com.couchbase.learningpath.data.warehouse.WarehouseRepository
1312
import com.couchbase.learningpath.data.warehouse.WarehouseRepositoryDb
1413
import com.couchbase.learningpath.models.*
1514
import com.couchbase.learningpath.services.MockAuthenticationService
1615
import com.couchbase.lite.CouchbaseLiteException
17-
import com.couchbase.lite.Dictionary
18-
import junit.framework.Assert.assertNull
19-
import kotlinx.coroutines.cancel
20-
import kotlinx.coroutines.delay
2116
import kotlinx.coroutines.flow.*
22-
import kotlinx.coroutines.launch
23-
import kotlinx.coroutines.test.UnconfinedTestDispatcher
2417
import kotlinx.coroutines.test.runTest
2518
import org.junit.*
2619
import org.junit.Assert.*
@@ -371,7 +364,7 @@ class DatabaseIntegrationTests {
371364
assertEquals(it.auditId, testAudit.auditId)
372365
assertEquals(it.stockItem, testAudit.stockItem)
373366
assertEquals(it.notes, testAudit.notes)
374-
assertEquals(it.count, testAudit.count)
367+
assertEquals(it.auditCount, testAudit.auditCount)
375368
assertEquals(it.team, testAudit.team)
376369
}
377370
}

src/app/src/main/java/com/couchbase/learningpath/data/project/ProjectRepositoryDb.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.couchbase.learningpath.data.project
33
import android.content.Context
44
import android.util.Log
55
import com.couchbase.lite.*
6-
import com.couchbase.lite.Function
76
import kotlinx.coroutines.Dispatchers
87
import kotlinx.coroutines.flow.Flow
98
import kotlinx.coroutines.flow.flow
@@ -197,7 +196,7 @@ class ProjectRepositoryDb(
197196
db?.let { database ->
198197
val query = QueryBuilder // 1
199198
.select(
200-
SelectResult.expression(Function.count(Expression.string("*")))
199+
SelectResult.expression(com.couchbase.lite.Function.count(Expression.string("*")))
201200
.`as`("count")
202201
) // 2
203202
.from(DataSource.database(database)) //3
@@ -261,7 +260,7 @@ class ProjectRepositoryDb(
261260
val auditDocument = Audit(
262261
auditId = UUID.randomUUID().toString(),
263262
projectId = projectId,
264-
count = (1..100000).random(),
263+
auditCount = (1..100000).random(),
265264
stockItem = stockItem,
266265
documentType = auditDocumentType,
267266
notes = "Found item ${stockItem.name} - ${stockItem.description} in warehouse",

src/app/src/main/java/com/couchbase/learningpath/models/Audit.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ data class Audit (
2020
var auditId: String = "",
2121
var projectId: String = "",
2222
var stockItem: StockItem? = null,
23-
var count: Int = 0,
23+
var auditCount: Int = 0,
2424
var documentType: String = "",
2525
var notes: String = "",
2626
//security tracking

src/app/src/main/java/com/couchbase/learningpath/services/AuditEditorStateService.kt

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/app/src/main/java/com/couchbase/learningpath/ui/audit/AuditCard.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fun AuditCard(
129129

130130
Text(
131131
modifier = Modifier.padding(start = 6.dp),
132-
text = audit.count.toString(),
132+
text = audit.auditCount.toString(),
133133
style = MaterialTheme.typography.caption,
134134
color = MaterialTheme.colors.onSurface
135135
)
@@ -166,7 +166,7 @@ fun AuditCardPreview() {
166166
auditId = "",
167167
projectId = "",
168168
stockItem = StockItem("000-000-0000", name = "Test Item", description = "Test Item Description", price = 0.0F, documentType="item"),
169-
count = 100,
169+
auditCount = 100,
170170
notes = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
171171
team = "Test Team",
172172
documentType = "Test Type",

src/app/src/main/java/com/couchbase/learningpath/ui/audit/AuditEditorViewModel.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class AuditEditorViewModel(
3939
//as the uuid is assigned by the repository
4040
auditId.value = audit.auditId
4141
auditState.value?.let {
42-
count.value = it.count.toString()
42+
count.value = it.auditCount.toString()
4343
if (it.stockItem != null) {
4444
it.stockItem?.let { stockItem ->
4545
stockItemSelectionState.value = stockItem.name
@@ -74,7 +74,7 @@ class AuditEditorViewModel(
7474
val onCountChanged: (String) -> Unit = { newValue ->
7575
if (newValue != "") {
7676
try {
77-
auditState.value?.count = newValue.toInt()
77+
auditState.value?.auditCount = newValue.toInt()
7878
count.value = newValue
7979
} catch (nfe: NumberFormatException) {
8080
Log.e("Error", nfe.message.toString())
@@ -121,7 +121,7 @@ class AuditEditorViewModel(
121121
viewModelScope.launch {
122122
if (projectId.value != "") {
123123
auditState.value?.let {
124-
if (it.count <= 0) {
124+
if (it.auditCount <= 0) {
125125
errorMessageState.value = "Error: Count must be greater than zero"
126126
} else if (it.stockItem == null) {
127127
errorMessageState.value = "Error: Must select stock item before saving"

src/app/src/main/java/com/couchbase/learningpath/ui/audit/AuditListView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fun AuditListPreview() {
107107
auditId = "",
108108
projectId = "",
109109
stockItem = StockItem("000-000-0000", name = "Test Item", description = "Test Item Description", price = 0.0F, documentType="item"),
110-
count = 100,
110+
auditCount = 100,
111111
notes = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
112112
team = "Test Team",
113113
documentType = "Test Type",

src/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
coroutines_tests_version = '1.6.3'
1616

1717
//couchbase
18-
couchbase_lite_version = '3.0.0'
18+
couchbase_lite_version = '3.0.2'
1919
}
2020

2121
repositories {

0 commit comments

Comments
 (0)