|
|
|
|
31
|
var dateRange = dateSelect.currentRange();
|
31
|
var dateRange = dateSelect.currentRange();
|
32
|
var startDate = "'"+dateRange[0]+"'";
|
32
|
var startDate = "'"+dateRange[0]+"'";
|
33
|
var endDate = "'"+dateRange[dateRange.length - 1]+"'";
|
33
|
var endDate = "'"+dateRange[dateRange.length - 1]+"'";
|
34
|
- var q = "SELECT time, machine, (SELECT name FROM items WHERE id = roasted_id) AS name, unroasted_total_quantity AS green, roasted_quantity AS roasted, ((unroasted_total_quantity - roasted_quantity) / unroasted_total_quantity * 100::numeric)::numeric(12,2) AS weight_loss, duration, annotation FROM roasting_log WHERE time >= " + startDate + "::date AND time < " + endDate + "::date + interval '1 day' ORDER BY time DESC";
|
|
|
|
|
34
|
+ var q = "SELECT time, machine, (SELECT name FROM items WHERE id = roasted_id) AS name, unroasted_total_quantity AS green, roasted_quantity AS roasted, CASE WHEN unroasted_total_quantity = 0 THEN NULL ELSE ((unroasted_total_quantity - roasted_quantity) / unroasted_total_quantity * 100::numeric)::numeric(12,2) END AS weight_loss, duration, annotation FROM roasting_log WHERE time >= " + startDate + "::date AND time < " + endDate + "::date + interval '1 day' ORDER BY time DESC";
|
35
|
table.setQuery(q);
|
35
|
table.setQuery(q);
|
36
|
table.hideColumn(1);
|
36
|
table.hideColumn(1);
|
37
|
}
|
37
|
}
|