mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3914 from overleaf/jel-graphs-cached-licenses
Use cached affiliation data GitOrigin-RevId: b8ae2b871cc1f3a11e61dd449b4d1ddc7835860d
This commit is contained in:
parent
4e9d7c36ff
commit
517485d7ea
2 changed files with 0 additions and 64 deletions
|
@ -1,7 +1,6 @@
|
||||||
const metrics = require('@overleaf/metrics')
|
const metrics = require('@overleaf/metrics')
|
||||||
const AnalyticsManager = require('./AnalyticsManager')
|
const AnalyticsManager = require('./AnalyticsManager')
|
||||||
const AuthenticationController = require('../Authentication/AuthenticationController')
|
const AuthenticationController = require('../Authentication/AuthenticationController')
|
||||||
const InstitutionsAPI = require('../Institutions/InstitutionsAPI')
|
|
||||||
const GeoIpLookup = require('../../infrastructure/GeoIpLookup')
|
const GeoIpLookup = require('../../infrastructure/GeoIpLookup')
|
||||||
const Features = require('../../infrastructure/Features')
|
const Features = require('../../infrastructure/Features')
|
||||||
|
|
||||||
|
@ -35,35 +34,5 @@ module.exports = {
|
||||||
AuthenticationController.getLoggedInUserId(req) || req.sessionID
|
AuthenticationController.getLoggedInUserId(req) || req.sessionID
|
||||||
AnalyticsManager.recordEvent(userId, req.params.event, req.body)
|
AnalyticsManager.recordEvent(userId, req.params.event, req.body)
|
||||||
res.sendStatus(202)
|
res.sendStatus(202)
|
||||||
},
|
|
||||||
|
|
||||||
licences(req, res, next) {
|
|
||||||
InstitutionsAPI.getInstitutionLicences(
|
|
||||||
req.query.resource_id,
|
|
||||||
req.query.start_date,
|
|
||||||
req.query.end_date,
|
|
||||||
req.query.lag,
|
|
||||||
function (error, licences) {
|
|
||||||
if (error) {
|
|
||||||
return next(error)
|
|
||||||
}
|
|
||||||
res.send(licences)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
},
|
|
||||||
|
|
||||||
newLicences(req, res, next) {
|
|
||||||
InstitutionsAPI.getInstitutionNewLicences(
|
|
||||||
req.query.resource_id,
|
|
||||||
req.query.start_date,
|
|
||||||
req.query.end_date,
|
|
||||||
req.query.lag,
|
|
||||||
function (error, licences) {
|
|
||||||
if (error) {
|
|
||||||
return next(error)
|
|
||||||
}
|
|
||||||
res.send(licences)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,10 +15,6 @@ describe('AnalyticsController', function () {
|
||||||
recordEvent: sinon.stub()
|
recordEvent: sinon.stub()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.InstitutionsAPI = {
|
|
||||||
getInstitutionLicences: sinon.stub().callsArgWith(4)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Features = {
|
this.Features = {
|
||||||
hasFeature: sinon.stub().returns(true)
|
hasFeature: sinon.stub().returns(true)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +24,6 @@ describe('AnalyticsController', function () {
|
||||||
'./AnalyticsManager': this.AnalyticsManager,
|
'./AnalyticsManager': this.AnalyticsManager,
|
||||||
'../Authentication/AuthenticationController': this
|
'../Authentication/AuthenticationController': this
|
||||||
.AuthenticationController,
|
.AuthenticationController,
|
||||||
'../Institutions/InstitutionsAPI': this.InstitutionsAPI,
|
|
||||||
'../../infrastructure/Features': this.Features,
|
'../../infrastructure/Features': this.Features,
|
||||||
'../../infrastructure/GeoIpLookup': (this.GeoIpLookup = {
|
'../../infrastructure/GeoIpLookup': (this.GeoIpLookup = {
|
||||||
getDetails: sinon.stub()
|
getDetails: sinon.stub()
|
||||||
|
@ -94,32 +89,4 @@ describe('AnalyticsController', function () {
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('licences', function () {
|
|
||||||
beforeEach(function () {
|
|
||||||
this.req = {
|
|
||||||
query: {
|
|
||||||
resource_id: 1,
|
|
||||||
start_date: '1514764800',
|
|
||||||
end_date: '1530662400',
|
|
||||||
resource_type: 'institution'
|
|
||||||
},
|
|
||||||
sessionID: 'sessionIDHere',
|
|
||||||
session: {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should trigger institutions api to fetch licences graph data', function (done) {
|
|
||||||
this.controller.licences(this.req, this.res)
|
|
||||||
this.InstitutionsAPI.getInstitutionLicences
|
|
||||||
.calledWith(
|
|
||||||
this.req.query.resource_id,
|
|
||||||
this.req.query.start_date,
|
|
||||||
this.req.query.end_date,
|
|
||||||
this.req.query.lag
|
|
||||||
)
|
|
||||||
.should.equal(true)
|
|
||||||
done()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue