phil : bug in code for generating course listings

26/06/12

Permalink 04:26:40 pm, by sarneil, 234 words, 103 views   English (CA)
Categories: Activity log; Mins. worked: 75

phil : bug in code for generating course listings

LW noticed that a number of courses that should have prerequisites listed didn't. I confirmed.
First guess was that the markup in the calendar html had changed so the regexp in the create course listing array functions were failing. Disproved that by labouriously testing the output of each regexp line.

There is a test in the code that says if you can't find the course in the current calendar AND the summer and winter sessions are looking at different calendars, look in the previous calendar (for cases where a course has been delisted but is still on offer for one last summer session). The actual syntax for the first part of that test was "$information.length < 1" which looks reasonable. In fact, "$information.length" is syntactically nonsensical, but rather than generate an error, it generates 0 which of course tests as < 1 so the whole thing tests as true. The test should read "strlen($information) < 1".
The rest of the conditional only mattered if a) you're in the months of June, July or August; b) the courses have been renumbered between last year and the current year. This is the first time since the code was written that all the conditions in the multiple-condition test were true, so the conditional block of code was executed and the wrong values put into the array.

When I replaced the incorrect bit of syntax the code worked properly.

Pingbacks:

No Pingbacks for this post yet...

Depts

This blog is for work done for academic departments which does not fall under other categories.

Reports

Categories

May 2013
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
      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  

XML Feeds