src/chartmogul/chartmogul-feeder.js
/**
   * THe middleware inf charge of fetching and calc the NET MRR Movements
   * based on others MRR Movements.
   *
   * @param {Object} config - The config require for the fetch
   * @return {Promise} The promisified geckoFormatted result of the fetch
   *
   */
THe middleware inf charge of fetching and calc the NET MRR Movements
based on others MRR Movements.

@param {Object} config - The config require for the fetch
@return {Promise} The promisified geckoFormatted result of the fetch
THe middleware inf charge of fetching and calc the NET MRR Movements based on others MRR Movements . @param { Object } config - The config require for the fetch @return { Promise } The promisified geckoFormatted result of the fetch
async fetchNetMRRMovement(config) {
    const weekInMS = 1000 * 60 * 60 * 24 * 7;
    const hasFetchInWeek =
      (new Date().getTime() - new Date(this.bestNetMRR_.lastFetch).getTime()) <
      weekInMS;
    const {
      entries,
    } = await this.requestChartMogulFor('/metrics/mrr', {
      'start-date': Util.convertDate(this.bestNetMRR_.startDate),
      'end-date': config['end-date'],
      'interval': config['interval'],
    });
    if (!this.bestNetMRR_.lastFetch || this.bestNetMRR_.val === 0
      ||
      !hasFetchInWeek) {
      this.bestNetMRR_.lastFetch = new Date().getTime();
      this.findMaxNetMRR(entries);
    }
    const netMrr = this.calcNetMRR(entries.pop());
    return {
      'item': [{
        'text': HTMLFormatter.toTextNetMrr(
          Util.toMoneyFormat(netMrr, ',', '.'),
          Util.toMoneyFormat(this.bestNetMRR_.val, ',', '.')
        ),
      }],
    };
  }
async fetchNetMRRMovement ( config ) { const weekInMS = 1000 * 60 * 60 * 24 * 7 ; const hasFetchInWeek = ( new Date ( ) . getTime ( ) - new Date ( this . bestNetMRR_ . lastFetch ) . getTime ( ) ) < weekInMS ; const { entries , } = await this . requestChartMogulFor ( '/metrics/mrr' , { 'start-date' : Util . convertDate ( this . bestNetMRR_ . startDate ) , 'end-date' : config [ 'end-date' ] , 'interval' : config [ 'interval' ] , } ) ; if ( ! this . bestNetMRR_ . lastFetch || this . bestNetMRR_ . val === 0 || ! hasFetchInWeek ) { this . bestNetMRR_ . lastFetch = new Date ( ) . getTime ( ) ; this . findMaxNetMRR ( entries ) ; } const netMrr = this . calcNetMRR ( entries . pop ( ) ) ; return { 'item' : [ { 'text' : HTMLFormatter . toTextNetMrr ( Util . toMoneyFormat ( netMrr , ',' , '.' ) , Util . toMoneyFormat ( this . bestNetMRR_ . val , ',' , '.' ) ) , } ] , } ; }
THe middleware inf charge of fetching and calc the NET MRR Movements
 based on others MRR Movements.
THe middleware inf charge of fetching and calc the NET MRR Movements based on others MRR Movements .
// 1,000 ms * 60 secs * 60 mins * 24 hrs * 7 days // ? Never made the fetch for the max. ? // ? Last fetch for the Max was more thna 1 weeek ago ?