fork download
  1. RECORD.prototype.calc_computed = function() {
  2. this.computed = new Object();
  3. this.computed.pacing = -1;
  4. this.computed.projected = -1;
  5. var booked = this.data[FLDS.booked];
  6. var deliv = this.data[FLDS.confirmed];
  7. if (booked > 0 && deliv > 0) {
  8. var ratio = deliv / booked;
  9. if (ratio < 20) {
  10. var start = this.data[FLDS.startdate];
  11. var end = this.data[FLDS.enddate];
  12. var pctcomp = 0; // see util.ctxinc: campaign_percent_complete
  13. if (end > start) {
  14. if (end <= RECORD_TODAY) {
  15. pctcomp = 1;
  16. }
  17. else {
  18. pctcomp = (RECORD_TODAY - start) / (end - start);
  19. }
  20. }
  21. if (pctcomp > 0) {
  22. ratio /= pctcomp;
  23. ratio *= 100;
  24. ratio = ratio.toFixed(2);
  25. this.computed.pacing = ratio;
  26. }
  27. }
  28. if (booked > deliv) {
  29. var owe = booked - deliv;
  30. var days_remain = (end - RECORD_TODAY) / 86400 + 1;
  31. this.computed.projected = parseInt(owe / days_remain, 10);
  32. }
  33. }
  34. };
  35.  
Runtime error #stdin #stdout 0.29s 213248KB
stdin
Standard input is empty
stdout
Standard output is empty