reportes

parent 569fe0c5
...@@ -73,11 +73,11 @@ let x = ''; ...@@ -73,11 +73,11 @@ let x = '';
if (sessionStorage.selectedMap) { if (sessionStorage.selectedMap) {
x = sessionStorage.selectedMap; x = sessionStorage.selectedMap;
console.log({x}) //console.log({x})
} }
else { else {
x = 'light'; x = 'light';
console.log({x}) //console.log({x})
} }
const polygonLayer = new ol.layer.Vector({ const polygonLayer = new ol.layer.Vector({
name: 'polygon', name: 'polygon',
...@@ -144,7 +144,7 @@ map.once('postrender', function (event) { ...@@ -144,7 +144,7 @@ map.once('postrender', function (event) {
setOpacity(sessionStorage.layerOpacity); setOpacity(sessionStorage.layerOpacity);
} }
console.log(sessionStorage) //console.log(sessionStorage)
if (sessionStorage.charttype) { if (sessionStorage.charttype) {
change(sessionStorage.charttype); change(sessionStorage.charttype);
...@@ -301,7 +301,7 @@ function compare(labels) { ...@@ -301,7 +301,7 @@ function compare(labels) {
//removeImageLayers(); //removeImageLayers();
map.addControl(ctrl); map.addControl(ctrl);
ctrl.set('position', 0.5); ctrl.set('position', 0.5);
//console.log(map.controls) ////console.log(map.controls)
var labelDateLeft = labels[0] //por default compara la primera y ultima fecha var labelDateLeft = labels[0] //por default compara la primera y ultima fecha
var labelDateRight = labels[labels.length - 1] var labelDateRight = labels[labels.length - 1]
...@@ -370,9 +370,9 @@ function selectLeft(date) { ...@@ -370,9 +370,9 @@ function selectLeft(date) {
//selecciona el lado derecho para comparar //selecciona el lado derecho para comparar
function selectRight(date) { function selectRight(date) {
console.log("---------"); //console.log("---------");
console.log(date) //console.log(date)
console.log("---------"); //console.log("---------");
var labelDateRight = date; var labelDateRight = date;
var layer_type = 'TCI'; var layer_type = 'TCI';
const right = new ol.layer.Tile({ const right = new ol.layer.Tile({
......
...@@ -26,7 +26,7 @@ document.getElementById("myChart").onclick = function (evt) { ...@@ -26,7 +26,7 @@ document.getElementById("myChart").onclick = function (evt) {
var firstPoint = activePoint[0]; var firstPoint = activePoint[0];
var label = myChart.data.labels[firstPoint._index]; var label = myChart.data.labels[firstPoint._index];
//console.log(firstPoint._datasetIndex) //indice de la clase a la que pertenece (vegetación, agua, etc.) ////console.log(firstPoint._datasetIndex) //indice de la clase a la que pertenece (vegetación, agua, etc.)
addImageLayer({ addImageLayer({
layerDate: label layerDate: label
...@@ -35,7 +35,7 @@ document.getElementById("myChart").onclick = function (evt) { ...@@ -35,7 +35,7 @@ document.getElementById("myChart").onclick = function (evt) {
// update date slider // update date slider
$('input[id="inputRange"]').val(firstPoint._index); $('input[id="inputRange"]').val(firstPoint._index);
//console.log(myChart.legend.legendItems[firstPoint._datasetIndex].text) //nombre de la capa a la que pertenece (vegetación, agua, etc.) ////console.log(myChart.legend.legendItems[firstPoint._datasetIndex].text) //nombre de la capa a la que pertenece (vegetación, agua, etc.)
//if (!firstPoint) return; //if (!firstPoint) return;
activePoints.forEach(function (value, index) { activePoints.forEach(function (value, index) {
//if(value==firstPoint){ //if(value==firstPoint){
...@@ -66,20 +66,20 @@ function play() { ...@@ -66,20 +66,20 @@ function play() {
//**************************** //****************************
function scl_on(imagePoint) { function scl_on(imagePoint) {
console.log("scl on!!") //console.log("scl on!!")
label = imagePoint; label = imagePoint;
//console.log({{SCL_PATH}}) ////console.log({{SCL_PATH}})
document.getElementById("satImage").src = "../../static/reports/tmpImages/repsat_test_dev/{{SCL_PATH}}" + label + "_SCL_60m_clasificationMap.png" document.getElementById("satImage").src = "../../static/reports/tmpImages/repsat_test_dev/{{SCL_PATH}}" + label + "_SCL_60m_clasificationMap.png"
// $(".next").show(); // $(".next").show();
// $(".prev").show(); // $(".prev").show();
} }
function open_big_image(image) { function open_big_image(image) {
console.log("Opening big image") //console.log("Opening big image")
console.log("image:") //console.log("image:")
console.log(image) //console.log(image)
image_big = image.replace("/thumbnails", ""); image_big = image.replace("/thumbnails", "");
console.log(image_big) //console.log(image_big)
window.open(image_big) window.open(image_big)
// $(".next").show(); // $(".next").show();
// $(".prev").show(); // $(".prev").show();
......
...@@ -399,31 +399,31 @@ ...@@ -399,31 +399,31 @@
var newLegendClickHandler = function (e, legendItem) { var newLegendClickHandler = function (e, legendItem) {
var index = legendItem.datasetIndex; var index = legendItem.datasetIndex;
//console.log(e) ////console.log(e)
console.log(legendItem.datasetIndex) //console.log(legendItem.datasetIndex)
console.log(legendItem.text) //console.log(legendItem.text)
var ch = this.chart; var ch = this.chart;
var meta = ch.getDatasetMeta(index); var meta = ch.getDatasetMeta(index);
console.log(meta.hidden) //console.log(meta.hidden)
var layer = legendItem.text.toLowerCase(); var layer = legendItem.text.toLowerCase();
//layer = layer.replace(" ", "_"); //layer = layer.replace(" ", "_");
layer = layer.replace(/\s/g,'_'); //reeemplaza los espacios con guion bajo layer = layer.replace(/\s/g,'_'); //reeemplaza los espacios con guion bajo
console.log(layer) //console.log(layer)
var activePoint = ch.getElementAtEvent(e); var activePoint = ch.getElementAtEvent(e);
console.log(document.getElementById("titleMap").textContent) //console.log(document.getElementById("titleMap").textContent)
var label = document.getElementById("titleMap").textContent; //obtiene la fecha que se está viendo var label = document.getElementById("titleMap").textContent; //obtiene la fecha que se está viendo
label = label.replace(/\//g,''); // reemplaza los diagonales por nada label = label.replace(/\//g,''); // reemplaza los diagonales por nada
console.log(label) //console.log(label)
if(meta.hidden){ if(meta.hidden){
console.log("Mostrar!!!") //console.log("Mostrar!!!")
SCLlayers.push(layer) SCLlayers.push(layer)
document.getElementById("scl_"+layer).src = "../../static/reports/tmpImages/repsat_test_dev/{{ SCL_PATH }}"+label+"_SCL_60m_"+layer+".png" document.getElementById("scl_"+layer).src = "../../static/reports/tmpImages/repsat_test_dev/{{ SCL_PATH }}"+label+"_SCL_60m_"+layer+".png"
} }
else{ else{
console.log("Ocultar!!") //console.log("Ocultar!!")
SCLlayers.splice(SCLlayers.indexOf(layer), 1); SCLlayers.splice(SCLlayers.indexOf(layer), 1);
document.getElementById("scl_"+layer).src = "" document.getElementById("scl_"+layer).src = ""
} }
...@@ -455,7 +455,7 @@ ...@@ -455,7 +455,7 @@
onClick: newLegendClickHandler, onClick: newLegendClickHandler,
} }
}; };
console.log(config); //console.log(config);
{% endautoescape %} {% endautoescape %}
</script> </script>
<script type="text/javascript" src="{% static 'reports/js/reportImg.js' %}"></script> <script type="text/javascript" src="{% static 'reports/js/reportImg.js' %}"></script>
......
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
</div> </div>
</div> </div>
<div id="action_buttons{{ product.purchase_id }}" <div id="action_buttons{{ product.purchase_id }}"
{% if product.progress != 100 %} {% if product.progress != 100 or not product.scl_data %}
class="hidden" {% endif %}> class="hidden" {% endif %}>
<a title="View Report" <a title="View Report"
{% if product.initial_folder %} {% if product.initial_folder %}
...@@ -258,7 +258,9 @@ ...@@ -258,7 +258,9 @@
<i class="fa fa-file-text"></i> <i class="fa fa-file-text"></i>
</a--> </a-->
</div> </div>
<span id="no_data{{ product.purchase_id }}" class="hidden">No Data</span>
<span id="no_data{{ product.purchase_id }}" {% if product.scl_data %}
class="hidden" {% endif %}>No Data</span>
</td> </td>
</tr> </tr>
...@@ -326,8 +328,7 @@ ...@@ -326,8 +328,7 @@
POLYGON POLYGON
</textarea> </textarea>
</div> </div>
<button style="float: left; type=" button <button style="float: left; type=" class="btn btn-default" onclick="copyPolygonText()">Copy polygon</button>
" class="btn btn-default" onclick="copyPolygonText()">Copy polygon</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div> </div>
</div> </div>
......
...@@ -567,29 +567,29 @@ ...@@ -567,29 +567,29 @@
showSCLcheckboxes(config.data.datasets); showSCLcheckboxes(config.data.datasets);
{% endautoescape %} {% endautoescape %}
console.log(lista_productos); //console.log(lista_productos);
function next_report(number) { function next_report(number) {
let index = lista_productos.indexOf(number); let index = lista_productos.indexOf(number);
console.log(index); //console.log(index);
index++; index++;
console.log(index); //console.log(index);
if (index >= lista_productos.length) if (index >= lista_productos.length)
index = 0; index = 0;
console.log(lista_productos[index]); //console.log(lista_productos[index]);
window.location.replace("../reports/" + lista_productos[index]); window.location.replace("../reports/" + lista_productos[index]);
} }
function previus_report(number) { function previus_report(number) {
let index = lista_productos.indexOf(number); let index = lista_productos.indexOf(number);
console.log(index); //console.log(index);
index--; index--;
console.log(index); //console.log(index);
if (index < 0) if (index < 0)
index = lista_productos.length - 1; index = lista_productos.length - 1;
console.log(lista_productos[index]); //console.log(lista_productos[index]);
window.location.replace("../reports/" + lista_productos[index]); window.location.replace("../reports/" + lista_productos[index]);
} }
......
...@@ -86,13 +86,6 @@ def report_L2ASCL(request, purchase_id): ...@@ -86,13 +86,6 @@ def report_L2ASCL(request, purchase_id):
} }
if os.path.exists(path + reporteDir + ".pdf"):
print ("si existe")
else:
#PDFGenerator(request, path, reporteDir, datasets,searchInfo)
pass
if request.user.is_authenticated: if request.user.is_authenticated:
product_list = Purchase.objects.values('id').filter( product_list = Purchase.objects.values('id').filter(
user_id__in=[request.user.id], user_id__in=[request.user.id],
...@@ -113,7 +106,7 @@ def report_L2ASCL(request, purchase_id): ...@@ -113,7 +106,7 @@ def report_L2ASCL(request, purchase_id):
producto['id'], producto['id'],
) )
print (productList) #print (productList)
return render(request, template, {"graphData": json.dumps(graphData), return render(request, template, {"graphData": json.dumps(graphData),
"searchInfo": searchInfo, "IMAGE_PATH": image_path, "searchInfo": searchInfo, "IMAGE_PATH": image_path,
"SCL_PATH": SCL_path, 'dafaultLabel': defaultLabel, "SCL_PATH": SCL_path, 'dafaultLabel': defaultLabel,
...@@ -188,9 +181,7 @@ def Reports(request): ...@@ -188,9 +181,7 @@ def Reports(request):
initial_folder = "." initial_folder = "."
absolute_path = USERS_PATH + producto['user__email'] + "/" + str(producto['id']) + "/" absolute_path = USERS_PATH + producto['user__email'] + "/" + str(producto['id']) + "/"
if not os.path.exists(absolute_path): if os.path.exists(absolute_path):
print("folder out noes not exists")
else:
for files in os.listdir(absolute_path): for files in os.listdir(absolute_path):
if files == 'scl_data.json': if files == 'scl_data.json':
# +(files) # +(files)
...@@ -206,7 +197,7 @@ def Reports(request): ...@@ -206,7 +197,7 @@ def Reports(request):
zip_path = USERS_PATH + producto['user__email'] + "/" + str(producto['id']) zip_path = USERS_PATH + producto['user__email'] + "/" + str(producto['id'])
# print(zip_path) # #print(zip_path)
# "../ static / reports / tmpImages / repsat_test_dev / umorales @ centrogeo.edu.mx / "+str(producto['id']) / myzip.zip" # "../ static / reports / tmpImages / repsat_test_dev / umorales @ centrogeo.edu.mx / "+str(producto['id']) / myzip.zip"
...@@ -301,10 +292,10 @@ def wsProcessProgress(request): ...@@ -301,10 +292,10 @@ def wsProcessProgress(request):
# item = Purchase.objects.get(pk=producto['id']) # item = Purchase.objects.get(pk=producto['id'])
# item.progress = progress # item.progress = progress
# item.save() # item.save()
print ('id: '+str(producto['id'])+'size: '+ str(os.path.getsize(USERS_PATH + producto['user__email'] + "/" + str(producto['id']) + "/scl_data.json"))) #print ('id: '+str(producto['id'])+'size: '+ str(os.path.getsize(USERS_PATH + producto['user__email'] + "/" + str(producto['id']) + "/scl_data.json")))
if os.path.getsize(USERS_PATH + producto['user__email'] + "/" + str(producto['id']) + "/scl_data.json") > 4: if os.path.getsize(USERS_PATH + producto['user__email'] + "/" + str(producto['id']) + "/scl_data.json") > 4:
Data = True Data = True
print (Data) #print (Data)
productList2.append({ productList2.append({
...@@ -327,10 +318,10 @@ def wsProcessProgress(request): ...@@ -327,10 +318,10 @@ def wsProcessProgress(request):
# "progress": producto['progress'], # "progress": producto['progress'],
# }) # })
#print (productList2) ##print (productList2)
return HttpResponse(json.dumps(productList2)) return HttpResponse(json.dumps(productList2))
else: else:
print("Error Http404") #print("Error Http404")
raise Http404 raise Http404
...@@ -639,7 +630,7 @@ def PDFGenerator(request,purchase_id): ...@@ -639,7 +630,7 @@ def PDFGenerator(request,purchase_id):
maxi = maxi maxi = maxi
else: else:
maxi = data['data'][index] maxi = data['data'][index]
# print (maxi) # #print (maxi)
values.append([data['data'][index]]) values.append([data['data'][index]])
labels.append(data['label']) labels.append(data['label'])
......
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