Ignore:
Timestamp:
11 Sep 2020, 11:47:23 (4 years ago)
Author:
Henrik Bettermann
Message:
 
Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r16081 r16234  
    7878
    7979from waeup.kofa.applicants.interfaces import IApplicantsUtils
     80from waeup.kofa.applicants.workflow import SUBMITTED
    8081
    8182from waeup.kofa.students.catalog import StudentQueryResultItem
     
    10831084    label =_('My ToDoList')
    10841085
     1086    def update(self):
     1087            self.local_roles = get_user_account(self.request).getLocalRoles()
     1088            return
     1089
    10851090    @property
    10861091    def getStudents(self):
    10871092        students = ([],[])
    10881093        cat = queryUtility(ICatalog, name='students_catalog')
    1089         local_roles = get_user_account(self.request).getLocalRoles()
    1090         for item in local_roles.get('waeup.local.TranscriptOfficer', []):
     1094        for item in self.local_roles.get('waeup.local.TranscriptOfficer', []):
    10911095            if isinstance(item, Faculty):
    10921096                faccode = item.code
     
    11011105        return students
    11021106
     1107    @property
     1108    def getApplicants(self):
     1109        applicants = []
     1110        cat = getUtility(ICatalog, name='applicants_catalog')
     1111        results = cat.searchResults(
     1112            container_code=('tsca0', 'tscz9'),
     1113            state=(SUBMITTED, SUBMITTED))
     1114        local_roles = self.local_roles.get('waeup.local.TranscriptOfficer', [])
     1115        if not local_roles:
     1116            return results
     1117        for item in local_roles:
     1118            if isinstance(item, Faculty):
     1119                faccode = item.code
     1120            else:
     1121                continue
     1122            for applicant in results:
     1123                course = getattr(applicant, 'course_studied', None)
     1124                if not course:
     1125                    continue
     1126                try:
     1127                    if course.__parent__.__parent__.__parent__.code == faccode:
     1128                        applicants.append(applicant)
     1129                except AttributeError:
     1130                    continue
     1131        return applicants
     1132
    11031133class TranscriptSigneeLandingPage(KofaPage):
    11041134    """Display students with validated transcript requests, when
     
    11101140    grok.template('mytranscriptrequests')
    11111141    label =_('My ToDoList')
     1142
    11121143
    11131144    @property
     
    11241155                    students[1].append(StudentQueryResultItem(result, self))
    11251156        return students
     1157
     1158    @property
     1159    def getApplicants(self):
     1160        return None
    11261161
    11271162#
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/mytranscriptrequests.pt

    r15163 r16234  
     1<h3 i18n:domain="waeup.kofa" i18n:translate="" tal:condition="view/getApplicants">
     2  Open Transcript Applications
     3</h3>
     4
     5<table class="kofa-data-table dataTable" tal:condition="view/getApplicants">
     6  <thead>
     7  <tr>
     8    <th i18n:translate="">Applicant Id</th>
     9    <th i18n:translate="">Full Name</th>
     10  </tr>
     11  </thead>
     12  <tbody>
     13  <tr tal:repeat="item view/getApplicants">
     14    <td> <a tal:attributes="href python:view.url(item)">
     15      <span tal:content="item/applicant_id">XXXX_1234</span></a>
     16    </td>
     17    <td tal:content="item/display_fullname">Bob</td>
     18  </tr>
     19  </tbody>
     20</table>
     21
    122<h3 i18n:domain="waeup.kofa" i18n:translate="" tal:condition="python:view.getStudents[0]">
    223  Transcripts to be validated
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r16213 r16234  
    5252from waeup.kofa.authentication import LocalRoleSetEvent
    5353from waeup.kofa.hostels.hostel import Hostel, Bed, NOT_OCCUPIED
     54from waeup.kofa.applicants.container import ApplicantsContainer
    5455from waeup.kofa.tests.test_async import FunctionalAsyncTestCase
    5556from waeup.kofa.browser.tests.test_pdf import samples_dir
     
    23982399        self.assertEqual(self.student['studycourse'].transcript_signees, None)
    23992400
     2401    def createTranscriptApplications(self):
     2402        # We create transcript application containers tscs1 and tscf2019
     2403        applicantscontainer1 = ApplicantsContainer()
     2404        applicantscontainer1.code = u'tscs1'
     2405        applicantscontainer1.prefix = u'app'
     2406        applicantscontainer1.year = 2020
     2407        applicantscontainer1.title = u'This is the TSC container'
     2408        applicantscontainer1.application_category = 'no'
     2409        applicantscontainer1.mode = 'create'
     2410        self.app['applicants']['tscs1'] = applicantscontainer1
     2411        applicantscontainer2 = ApplicantsContainer()
     2412        applicantscontainer2.code = u'tscf2020'
     2413        applicantscontainer2.prefix = u'app'
     2414        applicantscontainer2.year = 2020
     2415        applicantscontainer2.title = u'This is the TSC container'
     2416        applicantscontainer2.application_category = 'no'
     2417        applicantscontainer2.mode = 'create'
     2418        self.app['applicants']['tscf2020'] = applicantscontainer2
     2419        # Add applicants
     2420        self.applicant1 = createObject('waeup.Applicant')
     2421        self.applicant1.firstname = u'Joanne'
     2422        self.applicant1.lastname = u'Abba'
     2423        self.applicant1.course_studied = self.certificate
     2424        IWorkflowState(self.applicant1).setState('submitted')
     2425        self.app['applicants']['tscs1'].addApplicant(self.applicant1)
     2426        self.applicant2 = createObject('waeup.Applicant')
     2427        self.applicant2.firstname = u'Josef'
     2428        self.applicant2.lastname = u'Abba'
     2429        self.applicant2.course_studied = self.certificate
     2430        IWorkflowState(self.applicant2).setState('submitted')
     2431        self.app['applicants']['tscf2020'].addApplicant(self.applicant2)
     2432
    24002433    def test_landingpage_transcript_officer(self):
    24012434        IWorkflowState(self.student).setState('transcript requested')
     
    24122445        notify(LocalRoleSetEvent(
    24132446            fac, 'waeup.local.TranscriptOfficer', 'mrtranscript', granted=True))
     2447        self.createTranscriptApplications()
    24142448        # Login as transcript officer
    24152449        self.browser.open(self.login_path)
     
    24182452        self.browser.getControl("Login").click()
    24192453        self.assertMatches('...You logged in...', self.browser.contents)
     2454        # Officers do see the transcript applicants
     2455        self.assertTrue(
     2456            '<td>Josef Abba</td>' in self.browser.contents)
     2457        self.assertTrue(
     2458            '<td>Joanne Abba</td>' in self.browser.contents)
    24202459        # Officer is on landing page and does see the transcript link
    24212460        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.