mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -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 SplitTestUtils = require('./SplitTestUtils')
|
||||
const OError = require('@overleaf/o-error')
|
||||
const Settings = require('@overleaf/settings')
|
||||
const _ = require('lodash')
|
||||
const { CacheFlow } = require('cache-flow')
|
||||
|
||||
|
@ -52,7 +51,7 @@ async function getSplitTests({ name, phase, type, active, archived }) {
|
|||
return await SplitTest.find(filters)
|
||||
.populate('archivedBy', ['email', 'first_name', 'last_name'])
|
||||
.populate('versions.author', ['email', 'first_name', 'last_name'])
|
||||
.limit(100)
|
||||
.limit(300)
|
||||
.exec()
|
||||
} catch (error) {
|
||||
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
|
||||
* since deleting all records in staging or prod would be very bad...
|
||||
* As this is only used for utility in local dev environment, we should make sure this isn't run in
|
||||
* any other deployment environment.
|
||||
*/
|
||||
function _checkEnvIsSafe(operation) {
|
||||
if (Settings.splitTest.devToolbar.enabled) {
|
||||
throw OError.tag(
|
||||
`attempted to ${operation} all feature flags outside of local env`
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
throw new OError(
|
||||
`Attempted to ${operation} all feature flags outside of local env`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -432,11 +431,11 @@ async function _deleteSplitTests() {
|
|||
try {
|
||||
deleted = await SplitTest.deleteMany({}).exec()
|
||||
} catch (error) {
|
||||
throw OError.tag('Failed to delete all split tests')
|
||||
throw new OError('Failed to delete all split tests')
|
||||
}
|
||||
|
||||
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