-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.txt
46 lines (39 loc) · 4.06 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
I made note of a few minor typos I found that I think (today is the first day I have written JS or used React so take this
with a grain of salt) broke my program when I copy-pasted the given code snippets into my code. I also think I found one
fairly minor bug during the portion where we added the ability for users to edit scheduling data of courses.
On the page "Filter by time conflicts," the last block of code given for the App component is
missing the line "if (!schedule) return <h1>Loading schedule...</h1>;" which I think was
causing my page to not show anything for me.
Also on that page of the tutorial, the last block of code given for the Course component
I believe is missing the line "<div className="card-text">{ course.meets }</div>" to display
the scheduling info for the class.
On the page, "Store data," the boolean expression assigned to isDisabled is written as
"const isDisabled = hasConflict(course, selected);" rather than the previously given
"const isDisabled = !isSelected && hasConflict(course, selected);" which I think had the
effect of making selected classes appear grey rather than light green.
On the page "Add authentication," I believe the last code snippet for the TermSelector component is missing an opening
parenthesis immediately after its return keyword.
I also found one small bug which I think I was able to fix. That being said, there's a good chance this problem is specific to
me because I messed up some other part of the tutorial, and I haven't really convinced myself of the root cause of the bug if
it exists, although I think I've found a solution to it for now.
During the portion where we added the ability for users to change the scheduled times for classes, I noticed a bug where
when the time of a class was changed, if that class was selected at the time of the edit, the program would find that it had a
time conflict with itself, and would set the class to be disabled. Every soluton I tried just spawned more issues, but my
hypothesis right now is that 1. there isn't really a mechanism for things to get immediately removed from the list of selected
classes, only added, and 2. a selected class that gets edited might not be recognized as selected afterwards.
When we change the time of a class, we add create a new course with the updated info, but the old version - identical in all
ways except for the scheduling info - remains on the selected array. The isSelected var in the new course is initialized to
true if that course is on the list of selected courses, but only the old copy of the course will be on there, and since they
differ in their scheduling info, I'm not sure if array.includes or === will realize this new course ought to be considered
selected since its previous counterpart was also selected. Then, hasConflict will end up getting called when isDisabled is
initialized and will compare the new version of the course against the old version still on the selected array. This also
explains why the "conflict with self" issue doesn't happen with *all* selected courses: the logic for initializing isDisabled,
!isSelected && hasConflict(course, selected), usually wouldn't call hasConflict for a selected course, but because only the
old version is selected, it still gets called on the new version which finds a conflict with that old version.
The various new issues that arose during my attempts to fix this made me think that phenomenon might have potentially led to
other minor issues, but anyway, I think I managed to fix this by comparing classes by comparing only their unique ids rather
than using array.includes or just course1 === course2, and I added a check to hasConflict to not compare two course with the
same id against each other. I think there also may have been an issue with the new version of a course which was selected at
the time of its editing not being recognized as selected due to array.includes not recognizing that the course is present in
the selected array since the old version still in the array and the new version differ in their scheduling ifnormation despite
being the same in all other ways.