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,6 +4,12 @@ pluginContext.table.setHeaderData(2, "Set");
4 4
 pluginContext.table.setHeaderData(3, "Fan");
5 5
 pluginContext.table.setHeaderData(4, "Heater");
6 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 13
 var lines = pluginContext.data.split('\n');
8 14
 for(var i = 0; i < lines.length; i++) {
9 15
 	var fields = lines[i].split(',');

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

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

Loading…
Cancel
Save