Skip to content

Commit 0c08ded

Browse files
committed
feat: perfecting same course/class conflicts
1 parent 84103c2 commit 0c08ded

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

logic/classes.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export function buttonOptions(todo: any) {
33
let tooltips: String[] = []
44
let color = 'grey'
55
let icon = 'mdi-plus'
6+
let disabled = false
67

78
let sameCourse = todo.conflicts.sameCourse
89
// course already added
@@ -12,19 +13,22 @@ export function buttonOptions(todo: any) {
1213
icon = 'mdi-check'
1314
tooltips = ['Remove']
1415
color = 'success'
15-
} else if (todo.conflicts._any) {
16-
icon = 'mdi-alert-circle'
17-
tooltips = todo.conflicts.time.map((c: any) => 'Conflict: ' + c.name)
18-
color = 'error'
1916
} else {
2017
color = 'lime'
2118
tooltips = ['Course added in Section: ' + sameCourse.section, 'Replace?']
19+
icon = 'mdi-plus'
2220
}
2321
}
22+
if (todo.conflicts._any) {
23+
icon = 'mdi-alert-circle'
24+
tooltips = todo.conflicts.time.map((c: any) => 'Conflict: ' + c.name)
25+
color = 'error'
26+
disabled = true
27+
}
2428

2529
let buttonOptions = {
2630
icon,
27-
disabled: todo.conflicts._any,
31+
disabled,
2832
color,
2933
tooltips,
3034
}
@@ -48,7 +52,8 @@ export function findConflicts(checkClass: any, selectedClasses: any[]) {
4852
return (
4953
checkConflict(sc, checkClass) &&
5054
// can't conflict with itself or other same courses
51-
(sc.crn != checkClass.crn || sc.code != checkClass.code)
55+
sc.crn != checkClass.crn &&
56+
sc.code != checkClass.code
5257
)
5358
})
5459
let _any = time.length > 0

0 commit comments

Comments
 (0)