Skip to content

Commit

Permalink
WHISTLE-42: update the timestamp again
Browse files Browse the repository at this point in the history
  • Loading branch information
k-anderson committed Aug 23, 2012
1 parent 878c5c5 commit c59af71
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -14,7 +14,7 @@
"map": "function(doc) { if ( (doc.pvt_type != 'credit' && doc.pvt_type != 'debit') || doc.pvt_deleted) return; emit(doc.pvt_created, doc._id); }"
},
"reconcile_by_callid": {
"map": "function(doc){if (doc.pvt_created < 63512878164) return;if(doc.pvt_type=='cdr'){var Secs=doc.billing_seconds||0;var Cost=0;if(Secs>=1){var R=parseFloat(doc.custom_channel_vars.rate)||0;var RInc=parseInt(doc.custom_channel_vars.increment)||60;var RMin=parseInt(doc.custom_channel_vars.rate_minimum)||0;var Sur=parseInt(doc.custom_channel_vars.surcharge)||0;R=Math.round(R*10000);if(RInc<1)RInc=60;if(Secs<=RMin){Cost=Sur+((RMin/60)*R)}else{Cost=Sur+((RMin/60)*R)+(Math.ceil((Secs-RMin)/ RInc) * ((RInc /60)*R))}}if(Cost){emit(doc._id,Cost)}else{return}}else if((doc.pvt_type=='credit'||doc.pvt_type=='debit')&&doc.call_id&&doc.account_id==doc.pvt_account_id){var modifier=(doc.pvt_type=='credit'?1:-1);emit(doc.call_id,doc.amount*modifier)}else{return}}",
"map": "function(doc){if (doc.pvt_created < 63512985600) return;if(doc.pvt_type=='cdr'){var Secs=doc.billing_seconds||0;var Cost=0;if(Secs>=1){var R=parseFloat(doc.custom_channel_vars.rate)||0;var RInc=parseInt(doc.custom_channel_vars.increment)||60;var RMin=parseInt(doc.custom_channel_vars.rate_minimum)||0;var Sur=parseInt(doc.custom_channel_vars.surcharge)||0;R=Math.round(R*10000);if(RInc<1)RInc=60;if(Secs<=RMin){Cost=Sur+((RMin/60)*R)}else{Cost=Sur+((RMin/60)*R)+(Math.ceil((Secs-RMin)/ RInc) * ((RInc /60)*R))}}if(Cost){emit(doc._id,Cost)}else{return}}else if((doc.pvt_type=='credit'||doc.pvt_type=='debit')&&doc.call_id&&doc.account_id==doc.pvt_account_id){var modifier=(doc.pvt_type=='credit'?1:-1);emit(doc.call_id,doc.amount*modifier)}else{return}}",
"reduce": "_sum"
}
}
Expand Down

0 comments on commit c59af71

Please sign in to comment.