Skip to content

Instantly share code, notes, and snippets.

@kandelakig
Created April 3, 2013 16:06
Show Gist options
  • Save kandelakig/5302581 to your computer and use it in GitHub Desktop.
Save kandelakig/5302581 to your computer and use it in GitHub Desktop.
var q = azureClient.getTable('clientDevices').select('_count').where({ isActive: true })
if (filters.deviceModel && filters.deviceModel.length > 0) q.where(function(arr) { return this.deviceModel in arr }, filters.deviceModel)
if (filters.deviceOsVersion && filters.deviceOsVersion.length > 0) q.where(function(arr) { return this.deviceOsVersion in arr }, filters.deviceOsVersion)
if (filters.appVersion && filters.appVersion.length > 0) q.where(function(arr) { return this.appVersion in arr }, filters.appVersion)
if (filters.languageCode && filters.languageCode.length > 0) q.where(function(arr) { return this.languageCode in arr }, filters.languageCode)
if (filters.countryCode && filters.countryCode.length > 0) q.where(function(arr) { return this.countryCode in arr }, filters.countryCode)
q.where({ isDevMode: (filters.isDevMode) ? true : false })
if (filters.isAlertEnabled != undefined) q.where({ isAlertEnabled: filters.isAlertEnabled })
if (filters.isBadgeEnabled != undefined) q.where({ isBadgeEnabled: filters.isBadgeEnabled })
if (filters.isSoundEnabled != undefined) q.where({ isSoundEnabled: filters.isSoundEnabled })
if (filters.sessionCount.to) q.where(function(x) { return this.sessionCount <= x }, filters.sessionCount.to)
if (filters.sessionCount.from) q.where(function(x) { return this.sessionCount >= x}, filters.sessionCount.from)
q.read().then( . . . )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment