Browse Source

Fix roast data saving in manual log entry

Neal Wilson 7 years ago
parent
commit
6aaaee30c4
2 changed files with 15 additions and 2 deletions
  1. 6
    0
      config/ImportFilters/Ikawa.js
  2. 9
    2
      config/Windows/manuallogentry.xml

+ 6
- 0
config/ImportFilters/Ikawa.js View File

4
 pluginContext.table.setHeaderData(3, "Fan");
4
 pluginContext.table.setHeaderData(3, "Fan");
5
 pluginContext.table.setHeaderData(4, "Heater");
5
 pluginContext.table.setHeaderData(4, "Heater");
6
 pluginContext.table.setHeaderData(5, "Note");
6
 pluginContext.table.setHeaderData(5, "Note");
7
+pluginContext.table.clearOutputColumns();
8
+pluginContext.table.addOutputTemperatureColumn(1);
9
+pluginContext.table.addOutputTemperatureColumn(2);
10
+pluginContext.table.addOutputControlColumn(3);
11
+pluginContext.table.addOutputControlColumn(4);
12
+pluginContext.table.addOutputAnnotationColumn(5);
7
 var lines = pluginContext.data.split('\n');
13
 var lines = pluginContext.data.split('\n');
8
 for(var i = 0; i < lines.length; i++) {
14
 for(var i = 0; i < lines.length; i++) {
9
 	var fields = lines[i].split(',');
15
 	var fields = lines[i].split(',');

+ 9
- 2
config/Windows/manuallogentry.xml View File

151
 		pluginContext = {};
151
 		pluginContext = {};
152
 		pluginContext.table = findChildObject(this, 'log');
152
 		pluginContext.table = findChildObject(this, 'log');
153
 		pluginContext.table.setHeaderData(1, "Temp");
153
 		pluginContext.table.setHeaderData(1, "Temp");
154
+		pluginContext.table.addOutputTemperatureColumn(1);
154
 		pluginContext.table.setHeaderData(2, "Note");
155
 		pluginContext.table.setHeaderData(2, "Note");
156
+		pluginContext.table.addOutputAnnotationColumn(2);
155
 		pluginContext.graph = findChildObject(this, 'graph');
157
 		pluginContext.graph = findChildObject(this, 'graph');
156
 		pluginContext.preRun = function() {
158
 		pluginContext.preRun = function() {
157
 			var filename = QFileDialog.getOpenFileName(window, TTR("manualLogEntry", "Import"), QSettings.value('script/lastDir', '') + '/');
159
 			var filename = QFileDialog.getOpenFileName(window, TTR("manualLogEntry", "Import"), QSettings.value('script/lastDir', '') + '/');
279
 			currenttime.time = QTime(0, 0, 0, 0);
281
 			currenttime.time = QTime(0, 0, 0, 0);
280
 			currenttemperature.text = "";
282
 			currenttemperature.text = "";
281
 			currentnote.text = "";
283
 			currentnote.text = "";
284
+			pluginContext.table.clearOutputColumns();
285
+			pluginContext.table.addOutputTemperatureColumn(1);
286
+			pluginContext.table.addOutputAnnotationColumn(2);
282
 		});
287
 		});
283
 		var sampleGreenName = findChildObject(this, 'sampleGreenName');
288
 		var sampleGreenName = findChildObject(this, 'sampleGreenName');
284
 		var sampleGreenWeight = findChildObject(this, 'sampleGreenWeight');
289
 		var sampleGreenWeight = findChildObject(this, 'sampleGreenWeight');
365
 				var buffer = new QBuffer;
370
 				var buffer = new QBuffer;
366
 				buffer.open(3);
371
 				buffer.open(3);
367
 				pluginContext.table.saveXML(buffer);
372
 				pluginContext.table.saveXML(buffer);
373
+				buffer.open(3); /* saveXML closes the buffer */
368
 				var q = "INSERT INTO files (id, name, type, note, file) VALUES (default, :name, 'profile', NULL, :data) RETURNING id";
374
 				var q = "INSERT INTO files (id, name, type, note, file) VALUES (default, :name, 'profile', NULL, :data) RETURNING id";
369
 				query.prepare(q);
375
 				query.prepare(q);
370
 				query.bind(":name", roastTime.text + " Manual Entry");
376
 				query.bind(":name", roastTime.text + " Manual Entry");
371
-				query.bindDeviceData(":data", buffer);
377
+				query.bind(":data", buffer.readToString());
372
 				query.exec();
378
 				query.exec();
373
 				query.next();
379
 				query.next();
374
-				fileID = Number(query.value(0));
380
+				fileID = query.value(0);
381
+				buffer.close();
375
 			}
382
 			}
376
 			var rootIndex = machineModel.index(machineSelector.currentIndex, 0);
383
 			var rootIndex = machineModel.index(machineSelector.currentIndex, 0);
377
 			var selectedRoasterName = machineModel.data(rootIndex, 0);
384
 			var selectedRoasterName = machineModel.data(rootIndex, 0);

Loading…
Cancel
Save