Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
540e365
Refactor: Optimize imports on wc stats store
ParaskP7 Sep 8, 2025
13a299a
Analysis: Replace order stats error type with enum entries
ParaskP7 Sep 8, 2025
eafaa52
Analysis: Fix unreachable code on get new visitor stats
ParaskP7 Sep 8, 2025
587a818
Analysis: Merge call chain to associate on get xyz stats
ParaskP7 Sep 8, 2025
10c0c88
Refactor: Reformat wc stats store (test)
ParaskP7 Sep 8, 2025
dafe3c2
Refactor: Make getNewVisitorStats suspend functions
ParaskP7 Sep 8, 2025
a9c67c1
Cleanup: Remove unnecessary rows affected from on wc stats changed
ParaskP7 Sep 8, 2025
13bb637
Refactor: Optimize imports on wc stats store test (and fix typo)
ParaskP7 Sep 8, 2025
f65dfe2
Test: Move wc stats test utils and wc stats store test to fluxc-plugin
ParaskP7 Sep 8, 2025
4f5a86e
Migrate: 'WCNewVisitorStatsModel' from wellsql to room
ParaskP7 Sep 8, 2025
10fbbfb
Db: Drop 'WCNewVisitorStatsModel' table from 'wp-fluxc'
ParaskP7 Sep 8, 2025
06cae58
Merge branch 'trunk' of github.com:woocommerce/woocommerce-android in…
ParaskP7 Sep 9, 2025
781b01b
Merge branch 'trunk' of github.com:woocommerce/woocommerce-android in…
ParaskP7 Sep 12, 2025
79d9649
Migrate: 'WCNewVisitorStatsModel' from wellsql to room (v2)
ParaskP7 Sep 12, 2025
e1694cd
Cleanup: Remove unnecessary is custom field logic from new visitor stats
ParaskP7 Sep 12, 2025
ef6197e
Cleanup: Remove leftover custom keywork from new visitor stats dao
ParaskP7 Sep 12, 2025
2e11297
Refactor: Rename insert/update to replace stat on new visitor stats dao
ParaskP7 Sep 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class StatsRepository @Inject constructor(
result.granularity,
result.quantity,
result.date,
result.isCustomField
).let {
Result.success(it.values.sum())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ class StatsRepository @Inject constructor(
result.granularity,
result.quantity,
result.date,
result.isCustomField
)
}
Result.success(visitorStats)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ class StatsRepositoryTests : BaseUnitTest() {
fun `when visitors and revenue requests succeed then a success response is returned containing both value`() =
testBlocking {
val granularity = WCStatsStore.StatsGranularity.DAYS
val quantity = "5"
val startDate = "2024-01-25 00:00:00"
val endDate = "2024-01-25 23:59:59"
val visitorStatsResponse = WCStatsStore.OnWCStatsChanged(
rowsAffected = 2,
granularity = granularity,
quantity = "5",
quantity = quantity,
date = startDate
)

Expand All @@ -87,6 +87,8 @@ class StatsRepositoryTests : BaseUnitTest() {
whenever(selectedSite.get()).thenReturn(defaultSiteModel)
whenever(wooCommerceStore.getSiteSettings(any())).thenReturn(null)
whenever(wcStatsStore.fetchNewVisitorStats(any())).thenReturn(visitorStatsResponse)
whenever(wcStatsStore.getNewVisitorStats(defaultSiteModel, granularity, quantity, startDate))
.thenReturn(emptyMap())
whenever(wcStatsStore.fetchRevenueStats(any())).thenReturn(revenueStatsResponse)
whenever(wcStatsStore.getRawRevenueStats(eq(defaultSiteModel), eq(granularity), eq(startDate), eq(endDate)))
.thenReturn(WCRevenueStatsModel())
Expand All @@ -111,7 +113,7 @@ class StatsRepositoryTests : BaseUnitTest() {
val granularity = WCStatsStore.StatsGranularity.DAYS
val startDate = "2024-01-25 00:00:00"
val endDate = "2024-01-25 23:59:59"
val visitorStatsResponse = WCStatsStore.OnWCStatsChanged(0, granularity).also {
val visitorStatsResponse = WCStatsStore.OnWCStatsChanged(granularity).also {
it.error = WCStatsStore.OrderStatsError()
it.causeOfChange = WCStatsAction.FETCH_NEW_VISITOR_STATS
}
Expand Down Expand Up @@ -150,7 +152,6 @@ class StatsRepositoryTests : BaseUnitTest() {
val granularity = WCStatsStore.StatsGranularity.DAYS
val startDate = "2024-01-25 00:00:00"
val visitorStatsResponse = WCStatsStore.OnWCStatsChanged(
rowsAffected = 2,
granularity = granularity,
quantity = "5",
date = startDate
Expand Down
15 changes: 0 additions & 15 deletions config/detekt/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2271,21 +2271,6 @@
<ID>UnitTestNamingRule:WCShippingLabelStoreTest.kt$WCShippingLabelStoreTest$@Test fun `verify shipping address`()</ID>
<ID>UnitTestNamingRule:WCStatsSqlUtilsTest.kt$WCStatsSqlUtilsTest$@Test @Suppress("LongMethod") fun testGetRawRevenueStatsForSiteAndUnit()</ID>
<ID>UnitTestNamingRule:WCStatsSqlUtilsTest.kt$WCStatsSqlUtilsTest$@Test @Suppress("LongMethod") fun testSimpleInsertionAndRetrievalOfRevenueStats()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Suppress("LongMethod") @Test fun testGetQuantityForMonths()</ID>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this (here and previous PRs) - a good reminder to look at the baseline (Detekt or Lint) when working on technical debt 🏅

<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Suppress("LongMethod") @Test fun testGetQuantityForWeeks()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Suppress("LongMethod") @Test fun testGetQuantityForYears()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test @Suppress("LongMethod") fun testGetRevenueAndOrderStatsForSite()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test @Suppress("LongMethod") fun testGetVisitorStatsForCurrentDayGranularity()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test @Suppress("LongMethod") fun testGetVisitorStatsForThisWeekGranularity()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test fun testFailedFetchingVisitorSummaryStats()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test fun testFetchBundlesErrorResponse()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test fun testFetchBundlesNullResponse()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test fun testFetchBundlesSuccessResponse()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test fun testFetchCurrentDayRevenueStatsDate()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test fun testFetchCurrentDayRevenueStatsDateSpecificEndDate()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test fun testGetNewVisitorStatsWithInvalidData()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test fun testGetQuantityForDays()</ID>
<ID>UnitTestNamingRule:WCStatsStoreTest.kt$WCStatsStoreTest$@Test fun testSuccessfulFetchingVisitorSummaryStats()</ID>
<ID>UnitTestNamingRule:WCTaxStoreTest.kt$WCTaxStoreTest$@Test fun `get stored tax class list for site`()</ID>
<ID>UnitTestNamingRule:WCUserStoreTest.kt$WCUserStoreTest$@Test fun `fetch user role`()</ID>
<ID>UnitTestNamingRule:WCUserStoreTest.kt$WCUserStoreTest$@Test fun `get user role from db`()</ID>
Expand Down
Loading