Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 1 addition & 6 deletions supabase/functions/_backend/utils/cloudflare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,9 @@ GROUP BY version_name`

export async function countDevicesCF(c: Context, app_id: string, customIdMode: boolean) {
// Use Analytics Engine DEVICE_INFO for counting devices
const customIdFilter = customIdMode ? `AND blob5 != ''` : ''
const query = `SELECT COUNT(DISTINCT blob1) AS total
FROM device_info
WHERE index1 = '${app_id}' ${customIdFilter}`
WHERE index1 = '${app_id}'`

cloudlog({ requestId: c.get('requestId'), message: 'countDevicesCF query', query })
try {
Expand Down Expand Up @@ -552,10 +551,6 @@ export async function readDevicesCF(c: Context, params: ReadDevicesParams, custo
const limit = params.limit ?? DEFAULT_LIMIT
const conditions: string[] = [`index1 = '${params.app_id}'`]

if (customIdMode) {
conditions.push(`blob5 != ''`)
}

if (params.deviceIds?.length) {
cloudlog({ requestId: c.get('requestId'), message: 'deviceIds', deviceIds: params.deviceIds })
if (params.deviceIds.length === 1) {
Expand Down
12 changes: 0 additions & 12 deletions supabase/functions/_backend/utils/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1194,12 +1194,6 @@ export async function readDevicesSB(c: Context, params: ReadDevicesParams, custo
.select('*')
.eq('app_id', params.app_id)

if (customIdMode) {
query = query
.not('custom_id', 'is', null)
.neq('custom_id', '')
}

if (params.deviceIds?.length) {
cloudlog({ requestId: c.get('requestId'), message: 'deviceIds', deviceIds: params.deviceIds })
if (params.deviceIds.length === 1)
Expand Down Expand Up @@ -1251,12 +1245,6 @@ export async function countDevicesSB(c: Context, app_id: string, customIdMode: b
.select('device_id', { count: 'exact', head: true })
.eq('app_id', app_id)

if (customIdMode) {
req
.not('custom_id', 'is', null)
.neq('custom_id', '')
}

const { count, error } = await req

if (error) {
Expand Down