Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observe blaze campaigns #2871

Merged
merged 2 commits into from
Oct 17, 2023
Merged

Observe blaze campaigns #2871

merged 2 commits into from
Oct 17, 2023

Conversation

hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented Oct 16, 2023

This PR adds support for observing DB changes related to the Blaze Campaigns.

No testing is required, it will be tested as part of the WCAndroid PRs.

@Transaction
@Query("SELECT * from BlazeCampaigns WHERE `siteId` = :siteId ORDER BY createdAt DESC")
fun getMostRecentCampaignForSite(siteId: Long): BlazeCampaignModel? {
return getCampaigns(siteId)?.firstOrNull()?.toDomainModel()
Copy link
Member Author

Choose a reason for hiding this comment

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

This implementation wasn't optimal, it loaded the whole campaigns list just to take the first one, I updated to use a pure SQLite implementation.

@JorgeMucientes JorgeMucientes merged commit 3caf105 into trunk Oct 17, 2023
@JorgeMucientes JorgeMucientes deleted the observe-blaze-campaigns branch October 17, 2023 10:10
@JorgeMucientes
Copy link
Contributor

Code looks good! Thanks for exposing an observable 👍🏼. I'll definitely be using that for the campaign list screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants