Pārlūkot izejas kodu

Fix specification recall

Neal Wilson 9 gadus atpakaļ
vecāks
revīzija
463d6b36d2
1 mainītis faili ar 13 papildinājumiem un 1 dzēšanām
  1. 13
    1
      config/Windows/roastspec.xml

+ 13
- 1
config/Windows/roastspec.xml Parādīt failu

@@ -30,7 +30,7 @@
30 30
             var tolerance = findChildObject(this, 'tolerance');
31 31
             var notes = findChildObject(this, 'notes');
32 32
             var savebutton = findChildObject(this, 'save');
33
-            selector['currentIndexChanged(int)'].connect(function() {
33
+            var updateDisplay = function() {
34 34
                 var query = new QSqlQuery();
35 35
                 query.prepare("SELECT loss, tolerance, notes FROM roasting_specification WHERE item = :id1 AND time = (SELECT max(time) FROM roasting_specification WHERE item = :id2)");
36 36
                 query.bind(":id1", selector.currentData());
@@ -39,13 +39,25 @@
39 39
                 if(query.next()) {
40 40
                     if(query.value(0).length > 0) {
41 41
                         expected.text = Number(query.value(0)) * 100;
42
+                    } else {
43
+                        expected.text = "";
42 44
                     }
43 45
                     if(query.value(1).length > 0) {
44 46
                         tolerance.text = Number(query.value(1)) * 100;
47
+                    } else {
48
+                        tolerance.text = "";
45 49
                     }
46 50
                     notes.plainText = query.value(2);
51
+                } else {
52
+                    expected.text = "";
53
+                    tolerance.text = "";
54
+                    notes.plainText = "";
47 55
                 }
48 56
                 query = query.invalidate();
57
+            };
58
+            updateDisplay();
59
+            selector['currentIndexChanged(int)'].connect(function() {
60
+                updateDisplay();
49 61
             });
50 62
             savebutton.clicked.connect(function() {
51 63
                 var query = new QSqlQuery();

Notiek ielāde…
Atcelt
Saglabāt