0.0
0 ORDER BY name]]>
SELECT id, name FROM items WHERE category = 'Coffee: Roasted' AND id IN (SELECT item FROM current_items) ORDER BY name
0.0
30
0) {
pluginContext.table.newAnnotation(currentnote.text, 1, 2);
}
currentnote.text = "";
var t = QTime();
t = t.fromString(currenttime.time, "hh:mm:ss");
t = t.addSecs(30);
currenttime.time = t;
currenttemperature.text = "";
});
currenttemperature.returnPressed.connect(addmeasurement.clicked);
currentnote.returnPressed.connect(addmeasurement.clicked);
var v1 = findChildObject(this, 'ms');
v1.triggered.connect(pluginContext.table.LOD_ms);
var v2 = findChildObject(this, '1s');
v2.triggered.connect(pluginContext.table.LOD_1s);
var v3 = findChildObject(this, '5s');
v3.triggered.connect(pluginContext.table.LOD_5s);
var v4 = findChildObject(this, '10s');
v4.triggered.connect(pluginContext.table.LOD_10s);
var v5 = findChildObject(this, '15s');
v5.triggered.connect(pluginContext.table.LOD_15s);
var v6 = findChildObject(this, '30s');
v6.triggered.connect(pluginContext.table.LOD_30s);
var v7 = findChildObject(this, '1m');
v7.triggered.connect(pluginContext.table.LOD_1m);
var clear = findChildObject(this, 'clear');
clear.triggered.connect(pluginContext.table.clear);
clear.triggered.connect(pluginContext.graph.clear);
clear.triggered.connect(function() {
currenttime.time = QTime(0, 0, 0, 0);
currenttemperature.text = "";
currentnote.text = "";
});
var sampleGreenName = findChildObject(this, 'sampleGreenName');
var sampleGreenWeight = findChildObject(this, 'sampleGreenWeight');
var productionGreenTable = findChildObject(this, 'productionGreenTable');
var greenModel = productionGreenTable.model();
var greenTotal = 0.0;
var updateGreenTable = function() {
var deleteRow = -1;
while((deleteRow = productionGreenTable.findData("delete", 0)) > -1) {
if(productionGreenTable.data(deleteRow, 0, 0) == "Delete") {
productionGreenTable.removeRow(productionGreenTable.findData("delete", 0));
} else {
break;
}
}
greenTotal = productionGreenTable.columnSum(1, 0);
productionGreenTable.resizeColumnToContents(0);
};
greenModel.dataChanged.connect(updateGreenTable);
var validateInputs = function() {
if(batchType.currentIndex == 0) {
/* Sample batch */
if(sampleGreenName.text.length == 0) {
tabs.setCurrentIndex(0);
displayError(TTR("manualLogEntry", "Data Entry Error"),
TTR("manualLogEntry", "Please enter a green coffee name."));
return false;
}
if(Number(sampleGreenWeight.text) <= 0 || isNaN(sampleGreenWeight.text)) {
tabs.setCurrentIndex(0);
displayError(TTR("manualLogEntry", "Data Entry Error"),
TTR("manualLogEntry", "Green coffee weight must be a number greater than 0."));
return false;
}
} else {
/* Production batch */
var itemArray = productionGreenTable.columnArray(0, 32).split("\\s*,\\s*");
var weightArray = productionGreenTable.columnArray(1, 0).split("\\s*,\\s*");
if((itemArray.length != weightArray.length) || (itemArray.length == 0)) {
tabs.setCurrentIndex(0);
displayError(TTR("manualLogEntry", "Data Entry Error"),
TTR("manualLogEntry", "Please check that at least one green coffee has been selected and each green coffee has a valid weight"));
return false;
}
if(Number(greenTotal) <= 0) {
tabs.setCurrentIndex(0);
displayError(TTR("manualLogEntry", "DataEntryError"),
TTR("manualLogEntry", "Total green coffee weight must be a number greater than 0."));
return false;
}
if(roastedItem.currentIndex == 0) {
tabs.setCurrentIndex(0);
displayError(TTR("manualLogEntry", "DataEntryError"),
TTR("manualLogEntry", "Please select a roasted coffee item."));
return false;
}
}
return true;
};
var roastDataExists = function() {
return (pluginContext.table.rowCount() > 0);
}
var doSubmit = function() {
window.close();
}
var submit = findChildObject(this, 'submit');
submit.clicked.connect(function() {
if(validateInputs()) {
doSubmit();
}
});
]]>