Code coverage report for src/flux/scores-export.coffee

Statements: 39.47% (15 / 38)      Branches: 0% (0 / 6)      Functions: 0% (0 / 7)      Lines: 39.47% (15 / 38)      Ignored: none     

All files » src/flux/ » scores-export.coffee
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76                                                                                                                          
var CrudConfig, JobActions, JobCrudConfig, JobListenerConfig, JobStore, ScoresExportConfig, _, actions, extendConfig, makeSimpleStore, moment, ref, ref1, ref2, store,
  slice = [].slice;
 
ref = require('./helpers'), CrudConfig = ref.CrudConfig, makeSimpleStore = ref.makeSimpleStore, extendConfig = ref.extendConfig;
 
ref1 = require('./job'), JobActions = ref1.JobActions, JobStore = ref1.JobStore;
 
JobListenerConfig = require('../helpers/job').JobListenerConfig;
 
_ = require('underscore');
 
moment = require('moment');
 
ScoresExportConfig = {
  _loaded: function(obj, id) {
    return this.emit('loaded', id);
  },
  getJobIdFromJobUrl: function(jobUrl) {
    var jobId, jobUrlSegments;
    jobUrlSegments = jobUrl.split('/api/jobs/');
    if (jobUrlSegments[1] != null) {
      jobId = jobUrlSegments[1];
    }
    return jobId;
  },
  _getId: function(obj, id) {
    var job, jobId;
    job = obj.job;
    jobId = this.getJobIdFromJobUrl(job);
    return {
      jobId: jobId,
      id: id
    };
  },
  exports: {
    getLatestExport: function(id) {
      var perfExports;
      perfExports = this._get(id);
      return _.chain(perfExports).sortBy(function(perfExport) {
        return perfExport.created_at;
      }).last().value();
    }
  }
};
 
JobCrudConfig = extendConfig(new JobListenerConfig(), new CrudConfig());
 
extendConfig(ScoresExportConfig, JobCrudConfig);
 
ScoresExportConfig.exports.isExported = ScoresExportConfig.exports.isSucceeded;
 
ScoresExportConfig.exports.isExporting = ScoresExportConfig.exports.isProgressing;
 
ScoresExportConfig["export"] = function() {
  var args, ref2;
  args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
  (ref2 = this.que).call.apply(ref2, [this].concat(slice.call(args)));
  return this.emitChange();
};
 
ScoresExportConfig.exported = function() {
  var args, id, jobId, ref2, ref3;
  args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
  (ref2 = this.queued).call.apply(ref2, [this].concat(slice.call(args)));
  ref3 = this._getId.apply(this, args), id = ref3.id, jobId = ref3.jobId;
  return this.startChecking.call(this, id, jobId);
};
 
ref2 = makeSimpleStore(ScoresExportConfig), actions = ref2.actions, store = ref2.store;
 
module.exports = {
  ScoresExportActions: actions,
  ScoresExportStore: store
};