MCPcopy Index your code
hub / github.com/codecombat/codecombat / checkForNewAchievement

Function checkForNewAchievement

app/core/application.js:160–176  ·  view source on GitHub ↗
(limit = 2)

Source from the content-addressed store, hash-verified

158 },
159
160 checkForNewAchievement (limit = 2) {
161 if (limit <= 0) return; // Base case to stop recursion after 'limit' calls
162
163 let startFrom;
164 const utils = require('core/utils')
165 if (utils.isOzaria) { return } // Not needed until/unlesss we start using achievements in Ozaria
166 if (me.get('lastAchievementChecked')) {
167 startFrom = new Date(me.get('lastAchievementChecked'))
168 } else {
169 startFrom = me.created()
170 }
171
172 const daysSince = moment.duration(new Date() - startFrom).asDays()
173 if (daysSince > 1) {
174 return me.checkForNewAchievement().then(() => this.checkForNewAchievement(limit - 1))
175 }
176 },
177
178 featureMode: {
179 useChina () { return api.admin.setFeatureMode('china').then(() => document.location.reload()) },

Callers

nothing calls this directly

Calls 3

createdMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected