MCPcopy Create free account
hub / github.com/codecombat/codecombat / updateExperimentValue

Method updateExperimentValue

app/models/User.js:792–801  ·  view source on GitHub ↗
(experimentName, newValue = null)

Source from the content-addressed store, hash-verified

790 }
791
792 updateExperimentValue (experimentName, newValue = null) {
793 let left
794 const experiments = _.sortBy((left = this.get('experiments')) != null ? left : [], 'startDate').reverse()
795 const experiment = _.find(experiments, { name: experimentName })
796 if (!experiment) { return console.error('No experiment found') }
797 experiment.value = newValue
798 experiment.probability = 1
799 this.set({ experiments })
800 return this.save()
801 }
802
803 getExperimentValue (experimentName, defaultValue = null, defaultValueIfAdmin = null) {
804 // Prefer the admin default for admins when provided

Callers

nothing calls this directly

Calls 4

getMethod · 0.95
errorMethod · 0.45
setMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected