diff --git a/ord_interface/editor/db/680b0d9fe649417cb092d790907bd5a5/full.pbtxt b/ord_interface/editor/db/680b0d9fe649417cb092d790907bd5a5/full.pbtxt index 0ede50e0..e4e3ae28 100644 --- a/ord_interface/editor/db/680b0d9fe649417cb092d790907bd5a5/full.pbtxt +++ b/ord_interface/editor/db/680b0d9fe649417cb092d790907bd5a5/full.pbtxt @@ -95,6 +95,19 @@ reactions { inputs { key: "5" value { + components { + identifiers { + type: SMILES + details: "6" + value: "5" + } + amount { + unmeasured { + type: SATURATED + details: "saturated" + } + } + } addition_order: 93 addition_time { value: 96.0 @@ -392,6 +405,14 @@ reactions { target_ph: 89.0 is_automated: true } + workups { + amount { + unmeasured { + type: CATALYTIC + details: "catalytic" + } + } + } outcomes { reaction_time { value: 113.0 diff --git a/ord_interface/editor/html/reaction.html b/ord_interface/editor/html/reaction.html index 639020e0..ec382c7d 100644 --- a/ord_interface/editor/html/reaction.html +++ b/ord_interface/editor/html/reaction.html @@ -220,7 +220,8 @@ - + + + + + + + +
reaction role
limiting reactant
amount
@@ -230,6 +231,12 @@
includes solutes
unmeasured?
details
@@ -340,7 +347,8 @@ reaction ID
includes workup
has derived amount
- + + amount
@@ -348,6 +356,12 @@ + + unmeasured? +
+ details
+ +
@@ -723,14 +737,21 @@ automated
details
- + + aliquot amount - +
±
+ + unmeasured? +
+ details
+ +
@@ -886,6 +907,11 @@ + + unmeasured? +
+ details
+ diff --git a/ord_interface/editor/js/amounts.js b/ord_interface/editor/js/amounts.js index 84d74722..5afdad54 100644 --- a/ord_interface/editor/js/amounts.js +++ b/ord_interface/editor/js/amounts.js @@ -22,6 +22,7 @@ exports = { unload, }; +const asserts = goog.require('goog.asserts'); const utils = goog.require('ord.utils'); const Amount = goog.require('proto.ord.Amount'); @@ -31,6 +32,9 @@ const Moles = goog.require('proto.ord.Moles'); const MolesUnit = goog.require('proto.ord.Moles.MolesUnit'); const Volume = goog.require('proto.ord.Volume'); const VolumeUnit = goog.require('proto.ord.Volume.VolumeUnit'); +const UnmeasuredAmount = goog.require('proto.ord.UnmeasuredAmount'); +const UnmeasuredAmountType = + goog.require('proto.ord.UnmeasuredAmount.UnmeasuredAmountType'); /** * Initializes the selector for an Amount section. @@ -149,6 +153,10 @@ function load(node, amount) { : null; utils.setOptionalBool($('.amount_includes_solutes.optional_bool', node), solutes); + } else if (amount.hasUnmeasured()) { + const unmeasured = amount.getUnmeasured(); + utils.setSelector($('.unmeasured_amount_type', node), unmeasured.getType()); + $('.unmeasured_amount_details', node).text(unmeasured.getDetails()); } } @@ -161,10 +169,13 @@ function unload(node) { const amount = new Amount(); // NOTE(kearnes): Take the closest amount section; there may be others // nested deeper (e.g. in ProductMeasurement fields under a ReactionProduct). - node = $('.amount', node).first(); + if (!$(node).hasClass("amount")) { + node = $('.amount', node).first(); + } const value = parseFloat($('.amount_value', node).text()); const precision = parseFloat($('.amount_precision', node).text()); const units = $('.amount_units', node).val(); + const unmeasuredDetails = $('.unmeasured_amount_details', node).text(); if (MassUnit[units]) { const message = new Mass(); if (!isNaN(value)) { @@ -206,6 +217,15 @@ function unload(node) { if (solutes !== null) { amount.setVolumeIncludesSolutes(solutes); } + } else if (unmeasuredDetails) { + const unmeasured = new UnmeasuredAmount(); + const unmeasuredType = + utils.getSelectorText($('.unmeasured_amount_type', node)[0]); + unmeasured.setType(UnmeasuredAmountType[unmeasuredType]); + unmeasured.setDetails(asserts.assertString(unmeasuredDetails)); + if (!utils.isEmptyMessage(unmeasured)) { + amount.setUnmeasured(unmeasured); + } } return amount; } diff --git a/ord_interface/editor/js/utils.js b/ord_interface/editor/js/utils.js index ffff6131..dcfde36c 100644 --- a/ord_interface/editor/js/utils.js +++ b/ord_interface/editor/js/utils.js @@ -561,6 +561,7 @@ async function compareDataset(fileName, dataset) { if (xhr.status === 200) { resolve(); } else { + console.log(xhr.response); reject(); } }; diff --git a/ord_interface/editor/py/serve.py b/ord_interface/editor/py/serve.py index d5a2050c..a7284d76 100644 --- a/ord_interface/editor/py/serve.py +++ b/ord_interface/editor/py/serve.py @@ -533,8 +533,8 @@ def compare(name): local_ascii = text_format.MessageToString(local) if remote_ascii != local_ascii: diff = difflib.context_diff(local_ascii.splitlines(), remote_ascii.splitlines(), n=10) - print(f"Datasets differ:\n{pprint.pformat(list(diff))}") - return "differs", 409 # "Conflict" + diff_text = pprint.pformat(list(diff)) + return diff_text, 409 # "Conflict" return "equals"