Skip to content

Commit

Permalink
chore: better code
Browse files Browse the repository at this point in the history
  • Loading branch information
kernoeb committed Sep 23, 2023
1 parent d40d757 commit 5d35f42
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/SelectPlanning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ export default {
},
getNames () {
const list = [...(this.favorites || []), ...(this.groupFavorites || []).map(v => v.plannings).flat()]
if (list?.length) {
if (list.length) {
this.$axios.$get('/api/v1/calendars/info', { params: { p: list.join(',') } }).then((data) => {
this.planningNames = data
}).catch(() => {
Expand Down
2 changes: 1 addition & 1 deletion server/routes/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ router.get('/calendars', async (req, res) => {
for (const c in customColorList) {
if (typeof customColorList[c] !== 'string') delete customColorList[c]
}
if (Object.keys(customColorList)?.length === 0) customColorList = null
if (Object.keys(customColorList).length === 0) customColorList = null
} catch (e) {}

// Highlight courses with teachers
Expand Down
8 changes: 4 additions & 4 deletions server/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ const getColor = (value, location, description, options = {}) => {
if (options.highlightTeacher && checkHighlightTeacher({ description })) {
return '#676767'
} else if (value.includes('CM') || value.toUpperCase().includes('AMPHI') || location.toUpperCase().includes('AMPHI')) {
return options?.customColor?.amphi || '#efd6d8'
return options.customColor?.amphi || '#efd6d8'
} else if (value.includes('TP') || value.includes('TDi') || value.trim().match(/\sG\d\.\d$/)) {
return options?.customColor?.tp || '#bbe0ff'
return options.customColor?.tp || '#bbe0ff'
} else if ((value.includes('TD') || location.includes('V-B') || value.trim().match(/\sG\d$/)) && !/^S\d\.\d\d/.test(value) && !/contr[ôo]le/i.test(value)) {
return options?.customColor?.td || '#d4fbcc'
return options.customColor?.td || '#d4fbcc'
} else {
return options?.customColor?.other || '#EDDD6E'
return options.customColor?.other || '#EDDD6E'
}
}

Expand Down

0 comments on commit 5d35f42

Please sign in to comment.