Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/core/store/modules/gameContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default {
.finally(() => commit('toggleLoadingForCampaign', campaignId))
},

async generateLevelNumberMap ({ commit, state, dispatch, getters }, { campaignId, language }) {
async generateLevelNumberMap ({ commit, state, dispatch, getters }, { campaignId, language, courseId }) {
let gameContent = state.gameContent.byCampaign[campaignId]

if (!gameContent) {
Expand All @@ -196,7 +196,7 @@ export default {
allLevels.push(...levelsList)
}

const levelNumberMap = generateLevelNumberMap(allLevels)
const levelNumberMap = generateLevelNumberMap(allLevels, courseId)
commit('setLevelNumberMap', levelNumberMap)
},
},
Expand Down
2 changes: 1 addition & 1 deletion app/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ const createLevelNumberMap = function (levels, courseID) {
const levelNumberMap = {}
let practiceLevelTotalCount = 0
let practiceLevelCurrentCount = 0
const isCoco = !showOzaria()
const isCoco = !showOzaria() && !OZ_COURSE_IDS.includes(courseID || '')
for (let i = 0; i < levels.length; i++) {
const level = levels[i]
let levelNumber = (i - practiceLevelTotalCount) + 1
Expand Down
2 changes: 1 addition & 1 deletion app/views/teachers/TeacherCourseSolutionView.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ ${translateUtils.translateJS(a.slice(13, +(a.length - 4) + 1 || undefined), this
this.levels = new Levels(this.getGameContentAsLevels())
this.shownLevelModels = []
this.isJunior = this.courseID === utils.courseIDs.JUNIOR
store.dispatch('gameContent/generateLevelNumberMap', { campaignId: this.campaignId, language: this.language })
store.dispatch('gameContent/generateLevelNumberMap', { campaignId: this.campaignId, language: this.language, courseId: this.courseID })
.then(() => {
this.levelNumberMap = store.getters['gameContent/levelNumberMap']
this.updateLevelData()
Expand Down
1 change: 1 addition & 0 deletions ozaria/site/components/play/PageIntroLevel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export default Vue.extend({
fetchLevelNumber () {
this.generateLevelNumberMap({
campaignId: this.campaignId,
courseId: this.courseId,
language: this.language
}).then(() => {
this.levelNumber = this.getLevelNumber(this.introLevelData.original)
Expand Down
5 changes: 4 additions & 1 deletion ozaria/site/components/play/PagePlayLevel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ module.exports = Vue.extend({
data () {
return {
backboneView: PlayLevelView,
levelNumber: ''
levelNumber: '',
courseId: '',
}
},
computed: {
Expand Down Expand Up @@ -84,6 +85,7 @@ module.exports = Vue.extend({
},
},
mounted () {
this.courseId = utils.getQueryVariable('course')
if (this.campaignId) {
this.fetchLevelNumber()
}
Expand All @@ -110,6 +112,7 @@ module.exports = Vue.extend({
fetchLevelNumber () {
this.generateLevelNumberMap({
campaignId: store.state.game.level.campaign,
courseId: this.courseId,
language: utils.getQueryVariable('codeLanguage') || 'python'
}).then(() => {
this.levelNumber = this.getLevelNumber(store.state.game.level.original)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default Vue.extend({
// TODO move heroName to Vuex store `me` and use its getter as computed property.
this.heroName = (me.get('ozariaUserOptions') || {}).playerHeroName

this.generateLevelNumberMap({ campaignId: this.campaignData._id, language: this.codeLanguage })
this.generateLevelNumberMap({ campaignId: this.campaignData._id, courseId: this.courseId, language: this.codeLanguage })
},
methods: {
...mapActions({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default {
async created () {
await this.generateLevelNumberMap({
campaignId: this.getCurrentCourse.campaignID,
courseId: this.getCurrentCourse._id,
language: this.getSelectedLanguage,
})
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function getCurriculumGuideContentList ({ introLevels, moduleInfo, module
return curriculumGuideContentList
}

export function generateLevelNumberMap (contentTypes) {
export function generateLevelNumberMap (contentTypes, courseId) {
const levels = contentTypes
.map(({ original, assessment, icon, _id, practice, isIntroHeadingRow }) => {
let key = original
Expand All @@ -114,7 +114,7 @@ export function generateLevelNumberMap (contentTypes) {
}
}).filter(Boolean)

const levelNumberMap = utils.createLevelNumberMap(levels)
const levelNumberMap = utils.createLevelNumberMap(levels, courseId)
contentTypes.forEach((level) => {
const original = level.original || level.fromIntroLevelOriginal
if (!levelNumberMap[original]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ export default {
getLevelNumber: 'gameContent/getLevelNumber',
}),

isOzCourse () {
return utils.OZ_COURSE_IDS.includes(this.selectedCourseId)
},
courseInstances () {
return this.getCourseInstancesOfClass(this.classroom._id) || []
},
Expand Down Expand Up @@ -146,7 +149,7 @@ export default {
const course = this.classroomCourses.find(({ _id }) => _id === this.selectedCourseId)
const module = course?.modules?.[moduleNum] || {}
let moduleDisplayName = utils.i18n(module, 'name') || utils.i18n(course, 'name') || ''
if (utils.isOzaria) {
if (this.isOzCourse) {
moduleDisplayName = this.$t(`teacher.module${moduleNum}`) + moduleDisplayName
}

Expand Down Expand Up @@ -485,6 +488,7 @@ export default {
const course = this.classroomCourses.find(({ _id }) => _id === this.selectedCourseId)
await this.generateLevelNumberMap({
campaignId: course.campaignID,
courseId: course._id,
language: this.classroom.aceConfig.language,
})
},
Expand Down Expand Up @@ -526,7 +530,7 @@ export default {
let tooltipName
let levelName
const levelNumber = this.getLevelNumber(levelKey) || ''
if (utils.isCodeCombat) {
if (!this.isOzCourse) {
tooltipName = `${levelNumber}: ${utils.i18n(content, 'displayName') || utils.i18n(content, 'name')}`
levelName = tooltipName
} else {
Expand Down Expand Up @@ -695,7 +699,7 @@ export default {
normalizedType = 'challengelvl'
}

if (utils.isCodeCombat) {
if (!this.isOzCourse) {
if (content.shareable === 'project') {
normalizedType = 'capstone'
}
Expand All @@ -712,7 +716,7 @@ export default {

const isPractice = Boolean(content.practice)

if (utils.isCodeCombat) {
if (!this.isOzCourse) {
normalizedType = isPractice ? 'practicelvl' : normalizedType
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default {
},

isCodeCombat () {
return utils.isCodeCombat
return !utils.OZ_COURSE_IDS.includes(this.selectedCourseId)
},

listOfOriginals () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export default {
const course = this.classroomCourses.find(({ _id }) => _id === this.selectedCourseId)
this.generateLevelNumberMap({
campaignId: course.campaignID,
courseId: course._id,
language: this.classroom.aceConfig.language,
}).catch(console.error)
},
Expand Down