Typica is a free program for professional coffee roasters. https://typica.us
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

cuppingsessionsummary.xml 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <window id="cuppingsessionsummary">
  2. <layout type="vertical">
  3. <layout type="grid">
  4. <row>
  5. <column><label>Session ID:</label></column>
  6. <column><line id="session" writable="false" /></column>
  7. </row>
  8. <row>
  9. <column><label>Event:</label></column>
  10. <column><line id="event" writable="false" /></column>
  11. </row>
  12. <row>
  13. <column><label>Session Name:</label></column>
  14. <column><line id="name" writable="false" /></column>
  15. </row>
  16. <row>
  17. <column><label>Session Date:</label></column>
  18. <column><calendar id="date" /></column>
  19. </row>
  20. </layout>
  21. <button type="check" name="Session is open" id="open" />
  22. <label>Session Notes</label>
  23. <textarea id="notes" />
  24. <layout type="horizontal">
  25. <button name="View Session Data" id="data" type="push" />
  26. <button name="Submit" id="submit" type="push" />
  27. </layout>
  28. </layout>
  29. <program>
  30. <![CDATA[
  31. var window = this;
  32. var dateWidget = findChildObject(this, 'date');
  33. dateWidget.enabled = false;
  34. var viewbutton = findChildObject(this, 'data');
  35. var idField = findChildObject(this, 'session');
  36. viewbutton.clicked.connect(function() {
  37. var datascreen = createWindow("allforms");
  38. var datatable = findChildObject(datascreen, 'data');
  39. var averagetable = findChildObject(datascreen, 'averages');
  40. var q1 = "SELECT sample, grader, finalscore, aroma, flavor, aftertaste, acidity, body, uniformity, balance, cleancup, sweetness, overall, total FROM cuppingform_t1 WHERE session = ";
  41. q1 = q1 + idField.text;
  42. q1 = q1 + " ORDER BY sample";
  43. datatable.setQuery(q1);
  44. var q2 = "SELECT sample, avg(finalscore)::numeric(4,2) AS finalscore, avg(aroma)::numeric(4,2) AS aroma, avg(flavor)::numeric(4,2) AS flavor, avg(aftertaste)::numeric(4,2) AS aftertaste, avg(acidity)::numeric(4,2) AS acidity, avg(body)::numeric(4,2) AS body, avg(uniformity)::numeric(4,2) AS uniformity, avg(balance)::numeric(4,2) AS balance, avg(cleancup)::numeric(4,2) AS cleancup, avg(sweetness)::numeric(4,2) AS sweetness, avg(overall)::numeric(4,2) AS overall, avg(total)::numeric(4,2) AS total FROM cuppingform_t1 WHERE session = ";
  45. q2 = q2 + idField.text;
  46. q2 = q2 + " GROUP BY sample, position ORDER BY position";
  47. averagetable.setQuery(q2);
  48. });
  49. var submit = findChildObject(this, 'submit');
  50. var openBox = findChildObject(this, 'open');
  51. var notes = findChildObject(this, 'notes');
  52. submit.clicked.connect(function() {
  53. var query = new QSqlQuery;
  54. query.prepare("UPDATE cupping_sessions SET open = :open, note = :note WHERE id = :id");
  55. query.bind(":id", Number(idField.text));
  56. query.bind(":open", openBox.checked);
  57. query.bind(":note", notes.plainText);
  58. query.exec();
  59. window.close();
  60. });
  61. ]]>
  62. </program>
  63. </window>