Skip to content

Commit

Permalink
Fixed display of curriculum info when college is updated
Browse files Browse the repository at this point in the history
Fixed message when editing subject
Fixed routine to collect subject areas

Signed-off-by: Ricolindo L Carino <Ricolindo.Carino@gmail.com>
  • Loading branch information
Ricolindo L Carino authored and Ricolindo L Carino committed Jul 17, 2013
1 parent 21a7a7a commit 288470e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
1 change: 1 addition & 0 deletions EditCURRICULA.F90
Expand Up @@ -265,6 +265,7 @@ subroutine curriculum_edit(device, given)
else
! update existing
Curriculum(targetCurriculum) = wrk
targetCollege = wrk%CollegeIdx
end if
end if

Expand Down
4 changes: 2 additions & 2 deletions EditSUBJECTS.F90
Expand Up @@ -252,10 +252,10 @@ subroutine subject_edit(device)
Subject(NumSubjects+NumAdditionalSubjects) = wrk
crse = NumSubjects+NumAdditionalSubjects
tSubject = wrk%Name
remark = 'Added new subject '//wrk%Name
remark = ': Added new subject '//wrk%Name
call get_subject_areas()
else
remark = 'Add new subject failed; "'//trim(wrk%Name)//'" already exists.'
remark = ': Add new subject failed; "'//trim(wrk%Name)//'" already exists.'
end if
else
! update existing
Expand Down
35 changes: 29 additions & 6 deletions IO.F90
Expand Up @@ -869,20 +869,27 @@ end subroutine xml_teachers
subroutine get_subject_areas()

character (len=MAX_LEN_SUBJECT_CODE) :: token
integer :: i, j
integer :: i, j, k

NumSubjectAreas = 0
SubjectArea = TYPE_SUBJECT_AREA (SPACE, 0, 0)
do i=1,NumSubjects+NumAdditionalSubjects
token = Subject(i)%Name
j = index(token, SPACE)
token(j:) = SPACE
if (SubjectArea(NumSubjectAreas)%Code/=token) then
! find token if it already exists
k = 0
do j=NumSubjectAreas,1,-1
if (SubjectArea(j)%Code/=token) cycle
k = j
exit
end do
if (k==0) then ! not found
call check_array_bound (NumSubjectAreas+1, MAX_ALL_SUBJECTS/3, 'NumSubjectAreas')
NumSubjectAreas = NumSubjectAreas+1
SubjectArea(NumSubjectAreas) = TYPE_SUBJECT_AREA(token, Department(Subject(i)%DeptIdx)%CollegeIdx, 1)
else
SubjectArea(NumSubjectAreas)%Count = SubjectArea(NumSubjectAreas)%Count + 1
SubjectArea(k)%Count = SubjectArea(k)%Count + 1
end if
end do
end subroutine get_subject_areas
Expand Down Expand Up @@ -1119,6 +1126,7 @@ subroutine xml_read_subjects(pathToFile, errNo)

case ('/Subject') ! add temporary subject data to Subject()
i = index_to_subject(wrkSubject%Name)
!wrkSubject%TermOffered = 7 ! HARDCODE
Subject(i) = wrkSubject

case default
Expand Down Expand Up @@ -1492,7 +1500,7 @@ subroutine xml_read_curricula(pathToFile, errNo)
nLoad = tmpCurriculum%NSubjects
else
nLoad = 0
write(*,*) 'Not active: '//tmpCurriculum%Code
!write(*,*) 'Not active: '//tmpCurriculum%Code
end if
do k = 1, nLoad
i = tmpCurriculum%SubjectIdx(k)
Expand All @@ -1502,8 +1510,8 @@ subroutine xml_read_curricula(pathToFile, errNo)
strYear = txtYear(year)
strTerm = txtSemester(term)
call log_comment (trim(tmpCurriculum%Code)//', '// &
trim(strYear)//' year, '//trim(strTerm)//' term, '//trim(token)// &
': preq '//trim(text_prerequisite_in_curriculum(i))//' not specified earlier!')
trim(strYear)//' year, '//trim(strTerm)//' term, '//trim(token)// &
': preq '//trim(text_prerequisite_in_curriculum(i))//' not specified earlier!')
end if
end do
case default
Expand All @@ -1513,6 +1521,18 @@ subroutine xml_read_curricula(pathToFile, errNo)
end do

close(unitXML)

! sort
do i=1,NumCurricula-1
do j=i+1,NumCurricula
if (Curriculum(i)%Code>Curriculum(j)%Code) then
tmpCurriculum = Curriculum(i)
Curriculum(i) = Curriculum(j)
Curriculum(j) = tmpCurriculum
end if
end do
end do

call log_comment (itoa(NumCurricula)//' curricula in '//pathToFile)

end subroutine xml_read_curricula
Expand Down Expand Up @@ -2014,6 +2034,9 @@ subroutine xml_write_sections(path, NumSections, Section, iDept)
else
fileName = trim(path)//'CLASSES.XML'
end if

call html_comment('xml_write_sections('//trim(fileName)//')')

open(unit=unitXML, file=fileName, status='unknown')
write(unitXML,AFORMAT) XML_DOC

Expand Down

0 comments on commit 288470e

Please sign in to comment.