The way the code calculates the accumulated credit has to do with determining what courses are considered year long courses; if the duration of the course is less than the total number of terms for the year, then it is not considered a full year course and the credits are doubled. It is very likely when it is duplicating credits when it shouldn't that a summer term is included in the affected school year and level.