diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9765c3f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*pyc +*# +.#* diff --git a/documents.py b/documents.py index 5581011..f0486d3 100644 --- a/documents.py +++ b/documents.py @@ -160,12 +160,16 @@ class Job(BackendDocument): #TODO accountId, bundleId, storeCountry, appType{AppStoreApp,CydiaApp}, executionStrategy{DefaultExecution,OpenCloseExecution,RandomExecution,SmartExecution} 'worker': Worker, 'device': Device, - 'date_added': float + 'date_added': float, + 'error_message': unicode, + 'compatible_devices': int } required_fields = ['type', 'state', 'jobInfo'] default_values = { 'date_added': time.time, - 'state': STATE.UNDEFINED + 'state': STATE.UNDEFINED, + # 100 for ipad, 10 for iPhone and 1 for iPod + 'compatible_devices': 0b111 } indexes = [{ 'fields':['type', 'state'], @@ -223,7 +227,24 @@ def can_run_on_device(self, device): if country == acc.storeCountry: return True return False - return True + if 'minimumOSVersion' in self.jobInfo: + minimumOSVersion = int(self.jobInfo['minimumOSVersion']) + productVersion = int(''.join(device['deviceInfo']['ProductVersion'].split('.'))) + if productVersion < minimumOSVersion: + return False + + deviceClass = device['deviceInfo']['DeviceClass'] + if deviceClass == 'iPad': + deviceClassValue = 0b100 + elif deviceClass == 'iPhone': + deviceClassValue = 0b10 + else: + deviceClassValue = 0b1 + + if not self.compatible_devices & deviceClassValue: + return False + else: + return True # A app is a concrete app (user account, version, bundleID) under test