mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #17436 from overleaf/ab-split-test-export-cleanup
[web] Fix the split test export format and prune unwanted info GitOrigin-RevId: 2a8ecbd738338c16fee4bf1d286e724cc25c0008
This commit is contained in:
parent
310cbe10ba
commit
408e1dccd7
1 changed files with 8 additions and 9 deletions
|
@ -1,7 +1,6 @@
|
||||||
const { SplitTest } = require('../../models/SplitTest')
|
const { SplitTest } = require('../../models/SplitTest')
|
||||||
const SplitTestUtils = require('./SplitTestUtils')
|
const SplitTestUtils = require('./SplitTestUtils')
|
||||||
const OError = require('@overleaf/o-error')
|
const OError = require('@overleaf/o-error')
|
||||||
const Settings = require('@overleaf/settings')
|
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const { CacheFlow } = require('cache-flow')
|
const { CacheFlow } = require('cache-flow')
|
||||||
|
|
||||||
|
@ -52,7 +51,7 @@ async function getSplitTests({ name, phase, type, active, archived }) {
|
||||||
return await SplitTest.find(filters)
|
return await SplitTest.find(filters)
|
||||||
.populate('archivedBy', ['email', 'first_name', 'last_name'])
|
.populate('archivedBy', ['email', 'first_name', 'last_name'])
|
||||||
.populate('versions.author', ['email', 'first_name', 'last_name'])
|
.populate('versions.author', ['email', 'first_name', 'last_name'])
|
||||||
.limit(100)
|
.limit(300)
|
||||||
.exec()
|
.exec()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw OError.tag(error, 'Failed to get split tests list')
|
throw OError.tag(error, 'Failed to get split tests list')
|
||||||
|
@ -414,13 +413,13 @@ async function _saveSplitTest(splitTest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As this is only used for utility in local dev, we want to prevent this running in any other env
|
* As this is only used for utility in local dev environment, we should make sure this isn't run in
|
||||||
* since deleting all records in staging or prod would be very bad...
|
* any other deployment environment.
|
||||||
*/
|
*/
|
||||||
function _checkEnvIsSafe(operation) {
|
function _checkEnvIsSafe(operation) {
|
||||||
if (Settings.splitTest.devToolbar.enabled) {
|
if (process.env.NODE_ENV !== 'development') {
|
||||||
throw OError.tag(
|
throw new OError(
|
||||||
`attempted to ${operation} all feature flags outside of local env`
|
`Attempted to ${operation} all feature flags outside of local env`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,11 +431,11 @@ async function _deleteSplitTests() {
|
||||||
try {
|
try {
|
||||||
deleted = await SplitTest.deleteMany({}).exec()
|
deleted = await SplitTest.deleteMany({}).exec()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw OError.tag('Failed to delete all split tests')
|
throw new OError('Failed to delete all split tests')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!deleted.acknowledged) {
|
if (!deleted.acknowledged) {
|
||||||
throw OError.tag('Error deleting split tests, split tests have not updated')
|
throw new OError('Error deleting split tests, split tests have not updated')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue