avoid repeated values

parent f03ce510
......@@ -64,30 +64,35 @@ def productList(request):
## ----- aqui llamada a api sentinel
## ----- antes consultar en DB si no se tiene ya el producto
products = sentinel.getProducts(area, ("".join(init_date.split('-')), "".join(end_date.split('-'))),
{"platformname": "Sentinel-2", "cloudcoverpercentage": cloud_percentage})
date = ("".join(init_date.split('-')), "".join(end_date.split('-')))
params = {"platformname": "Sentinel-2"}
# if cloud_percentage.strip():
# params['cloudcoverpercentage'] = cloud_percentage
params['cloudcoverpercentage'] = cloud_percentage
products = sentinel.getProducts(area, date, params)
## simulation of 6-digit random id, this will be obtain from sentinel(?)
# random_id = ''.join(["%s" % random.randint(0, 9) for i in range(0, 6)])
## path from image preview storage location
img_preview = '/static/images/sat_preview/sat_test.jpg'
item_data = {
'process' : process,
'start_date' : init_date,
'end_date' : end_date,
'cloud_percentage': cloud_percentage
}
# se crea una lista de objetos del catalogo
catalog = []
for p in products:
img_link = products[p]['link_icon']
img_link = img_link[:img_link.find("/")+2] + "emmhp:geoemm29@" + img_link[img_link.find("/")+2:]
item_data['id'] = products[p]['uuid']
item_data['img'] = img_link
item_data['product'] = products[p]
catalog.append(item_data)
catalog.append({
'process' : process,
'start_date' : init_date,
'end_date' : end_date,
'cloud_percentage': cloud_percentage,
'product' : products[p],
'id' : products[p]['uuid'],
'img' : img_link
})
return JsonResponse({'catalog':catalog});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment