Skip to content

Instantly share code, notes, and snippets.

@aw3s0me
Created June 11, 2014 13:41
Show Gist options
  • Select an option

  • Save aw3s0me/463aae084f2103be94cc to your computer and use it in GitHub Desktop.

Select an option

Save aw3s0me/463aae084f2103be94cc to your computer and use it in GitHub Desktop.
adei_katrin_value_calc
jQuery('.field').each(function(i) {
var id = parseInt($(this).attr('id'));
var value = response.data[id].Value;
var floatvalue = parseFloat(response.data[id].RawValue);
var intvalue = parseInt(response.data[id].RawValue);
if ((id >= 2) && (id <= 9)) {
if (floatvalue > 849.5) {
value = "OPEN";
}
else if (floatvalue < -199.5) {
value = "SHORT";
}
}
else if ((id >= 66) && (id <= 74)) {
if (floatvalue == 0) {
value = "---";
}
}
else if ((id == 59) || (id == 61)) {
var otherside = parseFloat(response.data[id+1].RawValue);
var statusSum = floatvalue + otherside;
if (statusSum > 1.5) {
value = "INVALID";
}
else if (statusSum < 0.5) {
value = "MIDDLE";
}
else {
value = (floatvalue > 0.5) ? "IN" : "OUT";
}
}
else if ((id == 78) || (id == 82)) {
value = (intvalue > 5) ? "DISABLED" : "ENABLED";
}
else if ((id == 145) || (id == 146)) {
value = (floatvalue > 0.5) ? "YES" : "NO";
}
$(this).html(value);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment