Changeset 4302 for WAeUP_SRP/trunk
- Timestamp:
- 17 Jun 2009, 13:53:22 (16 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Students.py
r3682 r4302 599 599 ###) 600 600 601 def generateStudentId(self,letter,students = None): ###(602 import random603 r = random604 if students is None:605 students = self.portal_url.getPortalObject().campus.students606 if letter not in ('ABCDEFGIHKLMNOPQRSTUVWXY'):607 letter= r.choice('ABCDEFGHKLMNPQRSTUVWXY')608 sid = "%c%d" % (letter,r.randint(99999,1000000))609 while hasattr(students, sid):610 sid = "%c%d" % (letter,r.randint(99999,1000000))611 return sid612 #return "%c%d" % (r.choice('ABCDEFGHKLMNPQRSTUVWXY'),r.randint(99999,1000000))613 ### )601 #def generateStudentId(self,letter,students = None): ###( 602 # import random 603 # r = random 604 # if students is None: 605 # students = self.portal_url.getPortalObject().campus.students 606 # if letter not in ('ABCDEFGIHKLMNOPQRSTUVWXY'): 607 # letter= r.choice('ABCDEFGHKLMNPQRSTUVWXY') 608 # sid = "%c%d" % (letter,r.randint(99999,1000000)) 609 # while hasattr(students, sid): 610 # sid = "%c%d" % (letter,r.randint(99999,1000000)) 611 # return sid 612 # #return "%c%d" % (r.choice('ABCDEFGHKLMNPQRSTUVWXY'),r.randint(99999,1000000)) 613 ####) 614 614 615 615 InitializeClass(StudentsFolder) -
WAeUP_SRP/trunk/WAeUPImport.py
r4023 r4302 77 77 self.payments_catalog = waeup_tool.payments_catalog 78 78 self.applicants_catalog = waeup_tool.applicants_catalog 79 self.removed_student_ids = waeup_tool.removed_student_ids 79 80 #self.mode = mode 80 81 # self.import_method = getattr(self, '%s' % mode,None) … … 1012 1013 self.waeup_tool.exportAllStudyLevels(student_id = student_id) 1013 1014 # end export 1014 students_folder.manage_delObjects((student_id),) 1015 students_folder.manage_delObjects((student_id),) 1016 try: 1017 self.removed_student_ids.addRecord(id = student_id) 1018 except: 1019 msg = "Student already in removed_student_ids" 1015 1020 else: 1016 1021 msg = "Student object not found" -
WAeUP_SRP/trunk/WAeUPTables.py
r4244 r4302 1673 1673 course_results = self.course_results.evalAdvancedQuery(query) 1674 1674 yga1 = 0 1675 yg1 = [] 1675 1676 counter1 = 0 1676 1677 yga2 = 0 1678 yg2 = [] 1677 1679 counter2 = 0 1678 1680 yga3 = 0 1681 yg3 = [] 1679 1682 counter3 = 0 1680 1683 #import pdb;pdb.set_trace() 1681 1684 for brain in course_results: 1682 1685 try: 1683 if not float(brain.ca1) + float(brain.ca2) + float(brain.exam) > 0: 1686 om = float(brain.ca1) + float(brain.ca2) + float(brain.exam) 1687 if not om > 0: 1684 1688 continue 1685 1689 code = brain.code … … 1694 1698 if semester == '1': 1695 1699 counter1 += 1 1696 yga1 += float(brain.ca1) + float(brain.ca2) + float(brain.exam) 1700 yga1 += om 1701 yg1.append(om) 1697 1702 elif semester == '2': 1698 1703 counter2 += 1 1699 yga2 += float(brain.ca1) + float(brain.ca2) + float(brain.exam) 1704 yga2 += om 1705 yg2.append(om) 1700 1706 if semester == '3': 1701 1707 counter3 += 1 1702 yga3 += float(brain.ca1) + float(brain.ca2) + float(brain.exam) 1708 yga3 += om 1709 yg3.append(om) 1703 1710 except: 1704 1711 continue … … 1712 1719 yga3 /= counter3 1713 1720 yga3 = '%.2f' % yga3 1714 return yga1, yga2, yga3, counter1, counter2, counter3 1715 ###) 1721 return yga1, yga2, yga3, counter1, counter2, counter3, yg1, yg2, yg3 1722 ###) 1723 1724 1725 #security.declarePublic("calculateCoursePosition") 1726 def calculateCoursePosition(self,session_id,level_id,code,score,semester=None): 1727 #"""calculate Course Position""" 1728 query = Eq('session_id',session_id) & Eq('level_id',level_id) & Eq('code',code) 1729 course_results = self.course_results.evalAdvancedQuery(query) 1730 ygc = [] 1731 #import pdb;pdb.set_trace() 1732 for brain in course_results: 1733 try: 1734 if not float(brain.ca1) + float(brain.ca2) + float(brain.exam) > 0: 1735 continue 1736 #code = brain.code 1737 if semester: 1738 res = self.courses_catalog.evalAdvancedQuery(Eq('code',code)) 1739 if res: 1740 course = res[0] 1741 # The courses_catalog contains strings and integers in its semester field. 1742 # Maybe this can be fixed by reindexing the catalog. The schema of course says 'CPS Int Field'. 1743 semester_from_course = str(course.semester) 1744 else: 1745 continue 1746 if semester != semester_from_course: 1747 continue 1748 ygc.append(float(brain.ca1) + float(brain.ca2) + float(brain.exam)) 1749 except: 1750 continue 1751 ygc.sort(reverse=True) 1752 if not len(ygc): 1753 return 'no result' 1754 #import pdb;pdb.set_trace() 1755 for pos in range(len(ygc)): 1756 if ygc[pos] <= float(score): 1757 break 1758 output = {} 1759 output['pos'] = '%d of %d' % (pos+1,len(ygc)) 1760 output['ygc'] = ygc 1761 return output 1762 1763 security.declareProtected(ModifyPortalContent,"calculateAllCoursePositions") 1764 def calculateAllCoursePositions(self,session_id=None): 1765 """calculate All Course Positions""" 1766 if session_id: 1767 query = Eq('session_id',session_id) 1768 else: 1769 return 'no session_id provided' 1770 course_results = self.course_results.evalAdvancedQuery(query) 1771 for brain in course_results: 1772 try: 1773 if not float(brain.ca1) + float(brain.ca2) + float(brain.exam) > 0: 1774 continue 1775 res = self.courses_catalog.evalAdvancedQuery(Eq('code',brain.code)) 1776 if res: 1777 course = res[0] 1778 semester_from_course = str(course.semester) 1779 else: 1780 continue 1781 score = float(brain.ca1) + float(brain.ca2) + float(brain.exam) 1782 pic = self.calculateCoursePosition('08',brain.level_id,brain.code,score,semester_from_course)['pos'] 1783 data = {} 1784 data[self.key] = brain.key 1785 data['pic'] = pic 1786 self.modifyRecord(**data) 1787 except: 1788 continue 1789 return 'ready' 1716 1790 1717 1791 def exportRemoveAllCourses(self,student_id,export=False,remove=False): ###( … … 1884 1958 ###) 1885 1959 1960 class RemovedStudentIds(WAeUPTable): ###( 1961 1962 meta_type = 'WAeUP Removed StudentIds' 1963 name = "removed_student_ids" 1964 key = "id" 1965 def __init__(self,name=None): 1966 if name == None: 1967 name = self.name 1968 WAeUPTable.__init__(self, name) 1969 1970 1971 InitializeClass(RemovedStudentIds) 1972 1973 ###) 1974 1886 1975 # BBB: 1887 1976 AccomodationTable = AccommodationTable -
WAeUP_SRP/trunk/WAeUPTool.py
r4027 r4302 384 384 sid = "%c%d" % (letter,r.randint(99999,1000000)) 385 385 students = self.portal_url.getPortalObject().campus.students 386 while self.students_catalog(id = sid) or self.waeup_tool.picturePathExists(sid) :387 if not self.students_catalog(id =sid):388 logger.info(' only picture path %s exists' % sid)386 while self.students_catalog(id = sid) or self.waeup_tool.picturePathExists(sid) or self.removed_student_ids(id = sid): 387 if self.waeup_tool.picturePathExists(sid): 388 logger.info('picture path %s exists or in ' % sid) 389 389 sid = "%c%d" % (letter,r.randint(99999,1000000)) 390 390 return sid -
WAeUP_SRP/trunk/exportimport.py
r3494 r4302 137 137 importWAeUPTable(site.portal_catalog, '', context,'portal_catalog') 138 138 importWAeUPTable(site.portal_catalog_real, '', context,'portal_catalog_real') 139 importWAeUPTable(site.removed_student_ids, '', context,'removed_student_ids') 139 140 140 141 site.students_catalog.manage_setLocalGroupRoles(groupid='CampusOfficers', -
WAeUP_SRP/trunk/profiles/default/certificates_catalog.xml
r3689 r4302 1 1 <?xml version="1.0"?> 2 2 <?xml-stylesheet type="text/xsl" href="catalog.xsl"?> 3 <object name="c ourses_catalog" meta_type="WAeUP Table">3 <object name="certificates_catalog" meta_type="WAeUP Table"> 4 4 <column value="code"/> 5 5 <column value="faculty"/> -
WAeUP_SRP/trunk/profiles/default/layouts/application_pume.xml
r4265 r4302 1 1 <?xml version="1.0"?> 2 2 <?xml-stylesheet type="text/xsl" href="layout.xsl"?> 3 <?xml version="1.0"?>4 3 <object name="application_pume" meta_type="CPS Layout"> 5 4 <property name="layout_create_method"></property> -
WAeUP_SRP/trunk/profiles/default/toolset.xml
r3689 r4302 97 97 class="Products.WAeUP_SRP.WAeUPTables.StudentsCatalog"/> 98 98 <required tool_id="waeup_tool" 99 class="Products.WAeUP_SRP.WAeUPTool.WAeUPTool"/> 99 class="Products.WAeUP_SRP.WAeUPTool.WAeUPTool"/> 100 <required tool_id="removed_student_ids" 101 class="Products.WAeUP_SRP.WAeUPTables.RemovedStudentIds"/> 100 102 </tool-setup>
Note: See TracChangeset for help on using the changeset viewer.