function updateVolume()

in ui/src/app/common/components/indigo-components/directives/stoich-table/domain/reagent/calculation-row/reagent-row.js [87:101]


function updateVolume() {
    var areMolarityAndMolPreset = this.isMolarityPresent() && this.isMolPresent();
    var areDensityAndWeightPresent = this.isDensityPresent() && this.isWeightPresent();
    var isManuallyEntered = this.isWeightManuallyEntered() || this.isMolManuallyEntered() || this.isEqManuallyEntered();

    if (areMolarityAndMolPreset) {
        this.volume.value = mathCalculation.computeVolumeByMolarity(this.mol.value, this.molarity.value);
    } else if (areDensityAndWeightPresent) {
        this.volume.value = mathCalculation.computeVolumeByDensity(this.weight.value, this.density.value);
    }

    if (isManuallyEntered && (areMolarityAndMolPreset || areDensityAndWeightPresent)) {
        this.resetEntered([fieldTypes.volume]);
    }
}