Ejemplo n.º 1
0
    def test_post_user(self):
        self.mock_login_admin()

        # search participant info
        search_term = '*****@*****.**'
        response = self.post('/ag_search/', {'search_term': search_term})
        self.assertEqual(response.code, 200)
        for login in db.search_participant_info(search_term):
            for l in db.get_login_info(login):
                for field in l:
                    if field == 'ag_login_id':
                        self.assertNotIn(l[field], response.body)
                    else:
                        self.assertIn(l[field], response.body)
Ejemplo n.º 2
0
    def test_post_user(self):
        self.mock_login_admin()

        # search participant info
        search_term = '*****@*****.**'
        response = self.post('/ag_search/', {'search_term': search_term})
        self.assertEqual(response.code, 200)
        for login in db.search_participant_info(search_term):
            for l in db.get_login_info(login):
                for field in l:
                    if field == 'ag_login_id':
                        self.assertNotIn(l[field], response.body)
                    else:
                        self.assertIn(l[field], response.body)
Ejemplo n.º 3
0
    def post(self):
        term = self.get_argument('search_term')
        results = {}
        # search participant info
        logins = db.search_participant_info(term)
        results = set(logins)
        # search kit info and add to resluts
        logins = db.search_kits(term)
        results = results | set(logins)
        #  search barcode and add to results
        logins = db.search_barcodes(term)
        results = results | set(logins)
        # search handout kits
        handouts = db.search_handout_kits(term)

        # now take the ag_login_ids and collect the information to display
        display_results = []  # list of dictionatries
        for login in results:
            login_display = {}
            login_display['login_info'] = db.get_login_info(login)
            login_display['humans'] = db.getHumanParticipants(
                login)
            login_display['animals'] = db.getAnimalParticipants(
                login)
            login_display['kit'] = db.get_kit_info_by_login(login)
            for kit in login_display['kit']:
                barcode_info = {}
                ag_barcodes = db.get_barcode_info_by_kit_id(
                    kit['ag_kit_id'])
                barcode_info = {}
                for ag_barcode in ag_barcodes:
                    barcode_info[ag_barcode['barcode']] = {}
                    barcode_info[ag_barcode['barcode']]['ag_info'] = ag_barcode
                    lab_barcode_info = db.get_barcode_details(
                        ag_barcode['barcode'])
                    plate = db.get_plate_for_barcode(
                        ag_barcode['barcode'])
                    barcode_info[ag_barcode['barcode']]['barcode_info'] = \
                        lab_barcode_info
                    barcode_info[ag_barcode['barcode']]['plate'] = plate
                kit['barcode_info'] = barcode_info
            display_results.append(login_display)

        # now render the page
        self.render("ag_search.html",
                    results=display_results,
                    handouts=handouts,
                    currentuser=self.current_user)
Ejemplo n.º 4
0
    def post(self):
        term = self.get_argument('search_term')
        results = {}
        # search participant info
        logins = db.search_participant_info(term)
        results = set(logins)
        # search kit info and add to resluts
        logins = db.search_kits(term)
        results = results | set(logins)
        #  search barcode and add to results
        logins = db.search_barcodes(term)
        results = results | set(logins)
        # search handout kits
        handouts = db.search_handout_kits(term)

        # now take the ag_login_ids and collect the information to display
        display_results = []  # list of dictionatries
        for login in results:
            login_display = {}
            login_display['login_info'] = db.get_login_info(login)
            login_display['humans'] = db.getHumanParticipants(
                login)
            login_display['animals'] = db.getAnimalParticipants(
                login)
            login_display['kit'] = db.get_kit_info_by_login(login)
            for kit in login_display['kit']:
                barcode_info = {}
                ag_barcodes = db.get_barcode_info_by_kit_id(
                    kit['ag_kit_id'])
                barcode_info = {}
                for ag_barcode in ag_barcodes:
                    barcode_info[ag_barcode['barcode']] = {}
                    barcode_info[ag_barcode['barcode']]['ag_info'] = ag_barcode
                    lab_barcode_info = db.get_barcode_details(
                        ag_barcode['barcode'])
                    plate = db.get_plate_for_barcode(
                        ag_barcode['barcode'])
                    barcode_info[ag_barcode['barcode']]['barcode_info'] = \
                        lab_barcode_info
                    barcode_info[ag_barcode['barcode']]['plate'] = plate
                kit['barcode_info'] = barcode_info
            display_results.append(login_display)

        # now render the page
        self.render("ag_search.html", results=display_results,
                    handouts=handouts, currentuser=self.current_user)