Browse Source

check_all_update release desc

version2
venkata akhil 1 year ago
parent
commit
219064b82d
  1. 45
      smart_service/apis/update_validation.py

45
smart_service/apis/update_validation.py

@ -164,7 +164,7 @@ def check_all_vehicle_updates1(vehicle_list=None):
return {STATUS: 0, ERROR: "Check argument: vehicle list"}
@frappe.whitelist()
@frappe.whitelist(allow_guest = 1)
def check_all_vehicle_updates(vehicle_list=None):
# frappe.log_error('request' + str(vehicle_list))
rate_res = custom_rate_limit(limit=5, seconds=15)
@ -193,14 +193,14 @@ def check_all_vehicle_updates(vehicle_list=None):
for v in vehicle_data:
v_id = v['Vehicle']
current_version = float(v[CUR_VERSION])
data1_global = frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
data1_global = frappe.db.sql('''SELECT name,format(version,2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
and publish_status='Published' and publish_type='Global' and vehicle_status='Active' and publish_module='Automotive System'
order by version ASC;'''.format(v_id, lang), as_dict=1)
data1 = frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description
and version = (select max(version) as version from `tabPublish` where publish_module='Automotive System' and publish_type='Global');'''.format(v_id, lang), as_dict=1)
data1 = frappe.db.sql('''SELECT name,format(version,2) as version,vehicle_id,language,release_description as description
FROM `tabPublish` where vehicle='{}' and language='{}'
and publish_status='Published' and publish_type='{}' and vehicle_status='Active'
and publish_status='Published' and vehicle_status='Active'
and publish_module='Automotive System'
order by version ASC;'''.format(v_id, lang, publish_type[0][0]), as_dict=1)
and version = (select max(version) as version from `tabPublish` where publish_module='Automotive System' and publish_type='Internal');'''.format(v_id, lang, publish_type[0][0]), as_dict=1)
if publish_type[0][0] == "Global":
if current_version == float(data1_global[0]['version']):
@ -208,9 +208,12 @@ def check_all_vehicle_updates(vehicle_list=None):
vehicle_req_list.append(data1)
else:
if current_version < float(data1_global[0]['version']):
data = frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
and publish_status='Published' and publish_type='Global' and vehicle_status='Active' and version > '{}' and publish_module='Automotive System'
order by version ASC;'''.format(v_id, lang, current_version), as_dict=1)
data = frappe.db.sql('''SELECT name,format(version,2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
and publish_status='Published'
and vehicle_status='Active'
and version = (select max(version) as version from `tabPublish`
where publish_module='Automotive System' and publish_type='Global') and publish_module='Automotive System'
'''.format(v_id, lang, current_version), as_dict=1)
frappe.log_error(
'global_publish' + str(data))
publish_dec = frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
@ -246,25 +249,29 @@ def check_all_vehicle_updates(vehicle_list=None):
vehicle_req_list.append(data1)
else:
if current_version < float(data1[0]['version']):
data = frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
and publish_status='Published' and publish_type='Internal' and vehicle_status='Active' and version > '{}' and publish_module='Automotive System'
order by version ASC;'''.format(v_id, lang, current_version), as_dict=1)
data = frappe.db.sql('''SELECT name,format(version,2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
and publish_status='Published'
and vehicle_status='Active' and version > '{}' and publish_module='Automotive System'
and version = (select max(version) as version from `tabPublish` where publish_module='Automotive System' and publish_type='Internal')
'''.format(v_id, lang, current_version), as_dict=1)
# frappe.log_error(
# 'check_ful_inter' + str(data))
publish_dec = frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
# and publish_status='Published' and publish_type='Internal' and vehicle_status='Active' and version = '{}' and publish_module='Automotive System'
publish_dec = frappe.db.sql('''SELECT name,format(version,2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
# and publish_status='Published' and vehicle_status='Active' and version = '{}' and publish_module='Automotive System'
and version = (select max(version) as version from `tabPublish` where publish_module='Automotive System' and publish_type='Internal')
# order by version ASC;'''.format(v_id, lang, data1_global[0]['version']), as_dict=1)
elif current_version == float(data1[0]['version']):
if current_version < float(data1[0]['version']):
data = frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and
language='{}' and publish_status='Published' and publish_type='{}' and vehicle_status='Active' and version > '{}' and publish_module='Automotive System'
order by version ASC;'''.format(v_id, lang, publish_type[0][0], current_version), as_dict=1)
language='{}' and publish_status='Published' and vehicle_status='Active' and publish_module='Automotive System'
and version = (select max(version) as version from `tabPublish` where publish_module='Automotive System' and publish_type='{}')'''.format(v_id, lang, publish_type[0][0]), as_dict=1)
# frappe.log_error(
# 'check_ful_inter_else' + str(data))
publish_dec = frappe.db.sql('''SELECT name,format(max(version),2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
and publish_status='Published' and publish_type='Global' and vehicle_status='Active' and version ='{}' and publish_module='Automotive System'
order by version ASC;'''.format(v_id, lang, data1[0]['version']), as_dict=1)
publish_dec = frappe.db.sql('''SELECT name,format(version,2) as version,vehicle_id,language,release_description as description FROM `tabPublish` where vehicle='{}' and language='{}'
and publish_status='Published' and vehicle_status='Active' and publish_module='Automotive System'
and version = (select max(version) as version from `tabPublish` where publish_module='Automotive System' and publish_type='Global')
'''.format(v_id, lang, data1[0]['version']), as_dict=1)
# return data
# else:
# frappe.log_error(

Loading…
Cancel
Save