# this script it's a small Hell. Live is hard... import inspect import os import sys currentdir = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) sys.path.insert(0, os.path.dirname(os.path.dirname(currentdir))) from _common.api.auth import safeGETint from _common.api import headers from _common.api import auth from _common.api import db headers.jsonAPI() sync0 = safeGETint('sync0') sync1 = safeGETint('sync1') sync2 = safeGETint('sync2') sync3 = safeGETint('sync3') if sync0 == 1: sync0 = 0 else: sync0 = -1 if sync1 == 1: sync1 = 1 else: sync1 = -1 if sync2 == 1: sync2 = 2
sys.path.insert(0, os.path.dirname(os.path.dirname(currentdir))) from _common.api import auth from _common.api import headers from _common.api import db from _common.api import utils from _common.api import translation from mobile_service.apiv1._mobile import sql_request_ignore_error, getTotalIdsString, sql_request from _common.api._settings import mydb headers.jsonAPI() if (auth._POST is None): headers.errorResponse("Bad request") out = '' your = '' tasks = '' duplicate = (auth.safeGETint('duplicate') == 1) if ('out' in auth._POST) and not (auth._POST['out'] is None): out = utils.clearStringHard(auth._POST['out']) if ('your' in auth._POST) and not (auth._POST['your'] is None): your = utils.clearStringHard(auth._POST['your']) if ('tasks' in auth._POST) and not (auth._POST['tasks'] is None): tasks = utils.clearGlobalIds(auth._POST['tasks']) out_arr = [] your_arr = [] tasks_arr = [] tasks = getTotalIdsString(user_id=auth.user_id, devid=auth.user_some_state, cross=tasks, extendType=0)['info']['ids'] if len(tasks) < 1:
import sys import time currentdir = os.path.dirname(os.path.abspath( inspect.getfile(inspect.currentframe()))) sys.path.insert(0, os.path.dirname(os.path.dirname(currentdir))) from _common.api.auth import safeGETint from _common.api import headers from _common.api import db from _common.api import auth from _common.api import date_utils from _common.api._settings import mydb headers.jsonAPI() devid = safeGETint('devid') timezone_offset = safeGETint('timezone') if devid < 1: devid = 0 sql_filter = db.buildSqlPermissionfilter(auth.user_id, devid, True) timestamp_int = int(time.time() * 1000) time_endinterval = timestamp_int + 300 * 24 * 60 * 60 * 1000 sql = 'select * from tasks t where (t.type=0 or t.type=1) and t.state>=20 and t.start_time<' + str( time_endinterval) + ' and ' + sql_filter + ' order by t.type, t.start_time' db.sql_request(sql) rows = mydb.fetchall() json_result = [] toastMessage = None if (rows is None) or len(rows) < 1:
# this script it's a small Hell. Live is hard... import inspect import os import sys currentdir = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) sys.path.insert(0, os.path.dirname(os.path.dirname(currentdir))) from _common.api.auth import safeGETint from _common.api import headers from _common.api import db from _common.api import auth headers.jsonAPI() filter0 = safeGETint('filter0') == 1 filter1 = safeGETint('filter1') == 1 filter2 = safeGETint('filter2') == 1 filter3 = safeGETint('filter3') == 1 filterl = safeGETint('filterl') == 1 selected = safeGETint('selected') # if filter0 and filter1 and filter2 and filter3 and filterl: # filterl = False nodes = {} edges = {} own = db.getUserOwnDevices(user_id=auth.user_id) our_device_selected = False for value in own['all']: if selected == value['id']: our_device_selected = True