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

Function getNextLevelLink

ozaria/site/common/ozariaUtils.js:179–229  ·  view source on GitHub ↗
(levelData, options)

Source from the content-addressed store, hash-verified

177 */
178// TODO: move to app/core/urls and use `$.param(queryParams)` to build query string
179export const getNextLevelLink = (levelData, options) => {
180 let link = ''
181 if (levelData.type === 'intro') {
182 link = '/play/intro/' + levelData.slug
183 if (showOzaria()) {
184 link = '/play/ozaria/intro/' + levelData.slug
185 }
186 } else {
187 link = '/play/level/' + levelData.slug
188 if (showOzaria()) {
189 link = '/play/ozaria/level/' + levelData.slug
190 }
191 }
192
193 if (options.courseId && options.courseInstanceId) {
194 link += `?course=${encodeURIComponent(options.courseId)}&course-instance=${encodeURIComponent(options.courseInstanceId)}`
195 if (levelData.primerLanguage) {
196 link += `&codeLanguage=${encodeURIComponent(levelData.primerLanguage)}`
197 }
198 if (options.nextLevelStage) {
199 link += `&capstoneStage=${encodeURIComponent(options.nextLevelStage)}`
200 }
201 if (options.classroomId) {
202 link += `&classroom=${encodeURIComponent(options.classroomId)}`
203 }
204 } else if (options.courseInstanceId) {
205 link += `?course-instance=${encodeURIComponent(options.courseInstanceId)}`
206 if (options.codeLanguage) {
207 link += `&codeLanguage=${encodeURIComponent(options.codeLanguage)}`
208 }
209 if (options.nextLevelStage) {
210 link += `&capstoneStage=${encodeURIComponent(options.nextLevelStage)}`
211 }
212 } else if (options.courseId) {
213 link += `?course=${encodeURIComponent(options.courseId)}`
214 if (options.codeLanguage) {
215 link += `&codeLanguage=${encodeURIComponent(options.codeLanguage)}`
216 }
217 if (options.nextLevelStage) {
218 link += `&capstoneStage=${encodeURIComponent(options.nextLevelStage)}`
219 }
220 } else if (options.codeLanguage) {
221 link += `?codeLanguage=${encodeURIComponent(options.codeLanguage)}`
222 if (options.nextLevelStage) {
223 link += `&capstoneStage=${encodeURIComponent(options.nextLevelStage)}`
224 }
225 } else if (options.nextLevelStage) {
226 link += `?capstoneStage=${encodeURIComponent(options.nextLevelStage)}`
227 }
228 return link
229}
230
231export function internationalizeConfig (levelConfig, userLocale) {
232 const userGeneralLocale = (userLocale || '').split('-')[0]

Callers

nothing calls this directly

Calls 1

showOzariaFunction · 0.90

Tested by

no test coverage detected