Пример #1
0
    def register(self, front_end_str):

        cf = common_functions.Common_functions()
        appl = applicant.Applicant()

        error = []
        message = ''
        none = 0
        return_front_end_dict = ''

        front_end_dict = ast.literal_eval(front_end_str)
        front_end_data = front_end_dict['data'][0]

        error.append(appl.setUserId(front_end_data['user_id']))
        error.append(appl.setCampTimeSlots(front_end_data['camp_time_slots']))
        error.append(
            appl.setApplicantFirstName(front_end_data['applicant_first_name']))
        error.append(
            appl.setApplicantLastName(front_end_data['applicant_last_name']))
        error.append(appl.setApplicantAge(front_end_data['applicant_age']))
        error.append(
            appl.setApplicantGender(front_end_data['applicant_gender']))
        error.append(
            appl.setApplicantAddress(front_end_data['applicant_address']))
        error.append(
            appl.setGuardianFirstName(front_end_data['guardian_first_name']))
        error.append(
            appl.setGuardianLastName(front_end_data['guardian_last_name']))
        error.append(
            appl.setGuardianContactNumber(
                front_end_data['guardian_contact_number']))
        error.append(
            appl.setGuardianAddress(front_end_data['guardian_address']))
        error.append(appl.setApplicationDate(str(datetime.datetime.now())))
        error.append(
            appl.setEmergencyContact(front_end_data['emergency_contact']))
        error.append(appl.setPayment(front_end_data['payment']))
        error.append(appl.setGuardianSsn(front_end_data['guardian_ssn']))
        #print(front_end_str)
        #print(error)

        for i in range(0, len(error)):
            if error[i] != None:
                if message == '':
                    message = error[i]
                else:
                    message = message + '|' + error[i]

        if message == '':
            cf.insertIntoCsv('applicant.csv', appl)
            emp_appl = applicant.Applicant()
            return_front_end_dict = '{ "data": [' + json.dumps(
                emp_appl.__dict__
            ) + '], "status":"success", "message":"REGISTRATION COMPLETE" }'
        else:
            return_front_end_dict = '{ "data": [' + json.dumps(
                appl.__dict__
            ) + '], "status":"error", "message":"' + message + '" }'

        return return_front_end_dict
Пример #2
0
def extract_applicant_details(element, uni_name, course, status):
    applicant = applicants.Applicant()
    other_details = element.find_all("div", class_="col-sm-3")
    undergrad_details = other_details.__getitem__(3).get_text().split("\n").__getitem__(2).split(" ")
    applicant.__setattr__("name", element.find_all("a").__getitem__(0).get_text().strip())
    applicant.__setattr__("profile_link", element.find_all("a").__getitem__(0).get("href").strip())
    applicant.__setattr__("uni_name", uni_name)
    applicant.__setattr__("course_name", course)
    applicant.__setattr__("period", element.find_all("small").__getitem__(0).get_text().split("\n")[1:][1])
    applicant.__setattr__("gre", other_details.__getitem__(1).get_text().split("\n").__getitem__(2).strip())
    applicant.__setattr__("eng_test", other_details.__getitem__(2).get_text().split("\n").__getitem__(1).strip())
    applicant.__setattr__("eng_test_marks", other_details.__getitem__(2).get_text().split("\n").__getitem__(2).strip())
    applicant.__setattr__("undergrad_college", "")
    applicant.__setattr__("undergrad_marks", undergrad_details.__getitem__(0).strip())
    applicant.__setattr__("scoring", undergrad_details.__getitem__(1).strip())
    applicant.__setattr__("experience", other_details.__getitem__(4).get_text().split("\n").__getitem__(2).strip())
    applicant.__setattr__("status", status)
    return str(applicant)
import sys
sys.path.append("Python")
sys.path.append("Python/Entities")
import common_functions
import user
import applicant

a = applicant.Applicant()

#print(a.setAge('A'))

#print(a.getAge())

cf = common_functions.Common_functions()

print(cf.str_to_date("2016-11-21 00:35:28.438843"))

print(
    cf.weeks_between(cf.str_to_date("2016-11-21 00:35:28.438843"),
                     cf.str_to_date("2016-11-24 00:35:28.438843")))
Пример #4
0
    def updateRegisteredApplicantData(self, front_end_str):
        """ View Registered Applicant based on Application Id """
        cf = common_functions.Common_functions()
        appl = applicant.Applicant()

        error = []
        message = ''
        none = 0
        return_front_end_dict = ''

        front_end_dict = ast.literal_eval(front_end_str)
        front_end_data = front_end_dict['data'][0]

        print("front_end_data :", front_end_data)

        error.append(appl.setApplicantId(front_end_data['applicant_id']))
        error.append(appl.setUserId(front_end_data['user_id']))
        error.append(appl.setCampTimeSlots(front_end_data['camp_time_slots']))
        error.append(
            appl.setApplicantFirstName(front_end_data['applicant_first_name']))
        error.append(
            appl.setApplicantLastName(front_end_data['applicant_last_name']))
        error.append(appl.setApplicantAge(front_end_data['applicant_age']))
        error.append(
            appl.setApplicantGender(front_end_data['applicant_gender']))
        error.append(
            appl.setApplicantAddress(front_end_data['applicant_address']))
        error.append(
            appl.setGuardianFirstName(front_end_data['guardian_first_name']))
        error.append(
            appl.setGuardianLastName(front_end_data['guardian_last_name']))
        error.append(
            appl.setGuardianContactNumber(
                front_end_data['guardian_contact_number']))
        error.append(
            appl.setGuardianAddress(front_end_data['guardian_address']))
        error.append(
            appl.setEmergencyContact(front_end_data['emergency_contact']))
        error.append(appl.setPayment(front_end_data['payment']))
        error.append(appl.setGuardianSsn(front_end_data['guardian_ssn']))
        error.append(
            appl.setApplicationDate(front_end_data['application_date']))

        #print(front_end_str)
        #print(error)

        for i in range(0, len(error)):
            if error[i] != None:
                if message == '':
                    message = error[i]
                else:
                    message = message + '|' + error[i]

        if message == '':
            cf.updateManyRowIntoCsv('applicant.csv', [appl.__dict__],
                                    'applicant_id')
            return_front_end_dict = '{ "data": [' + json.dumps(
                appl.__dict__
            ) + '], "status":"success", "message":"APPLICANT DATA UPDATED" }'
        else:
            return_front_end_dict = '{ "data": [' + json.dumps(
                appl.__dict__
            ) + '], "status":"error", "message":"' + message + '" }'

        return return_front_end_dict
Пример #5
0
import sys
sys.path.append("Python/Entities")
import applicant
# import bunkhouse
ur = applicant.Applicant()  # Initialization
'''print('ur.setFirstName("Jemin ") :',ur.setFirstName("Jemin 1"))
=======
ur = bunkhouse.Bunkhouse()


print('ur.setBunkhouseName("Test 2") :',ur.setBunkhouseName("Test") )

print(ur.__dict__)



print('ur.setTribeName("Tribe 1") :',ur.setTribeName("TesT      "))
print(ur.getTribeName())
print(ur.__dict__)

'''

print('ur.setFirstName("Jemin ") :', ur.setFirstName("Jemin "))
# >>>>>>> refs/remotes/origin/master
print('ur.setLastName("Gohil")', ur.setLastName("Gohil"))
print(ur.getFirstName())
print(ur.getLastName())

print('ur.setGuardianFirstName("Abc"):', ur.setGuardianFirstName("Abc"))
print('ur.setGuardianLastName("gohil "):', ur.setGuardianLastName("gohil "))
print(ur.getGuardianFirstName())
    def getCustomerPriorities(self, front_end_str):
        """ get data for priorities from Customer """

        cf = common_functions.Common_functions()
        appl = applicant.Applicant()

        front_end_dict = ast.literal_eval(front_end_str)
        front_end_data = front_end_dict['data'][0]

        data = cf.getFromCsv('applicant.csv', front_end_data)

        if data == []:
            return_front_end_dict = '{ "data": [], "status":"success", "message":"No applicants registered"}'
        else:
            new_data = []
            list_of_names = ["NONE"]
            list_of_id = ["NONE"]

            for i in range(0, len(data)):
                name = data[i]['applicant_last_name'] + ', ' + data[i][
                    'applicant_first_name']
                if name not in list_of_names:
                    list_of_names.append(data[i]['applicant_last_name'] +
                                         ', ' +
                                         data[i]['applicant_first_name'])

            for j in range(0, len(data)):

                backup_list_of_names = copy.deepcopy(list_of_names)
                backup_list_of_id = copy.deepcopy(list_of_id)

                new_dict = {}
                new_dict['applicant_id'] = data[j]['applicant_id']
                new_dict['applicant_name'] = data[j][
                    'applicant_last_name'] + ', ' + data[j][
                        'applicant_first_name']
                new_dict[
                    'applicant_name_together_with'] = self.getCorrectSequence(
                        data[j]['applicant_name_together_with'],
                        backup_list_of_names)

                check_list_of_id1 = ['NONE']
                if data[j]['applicant_id_together_with'] != '':
                    dict_applicant_name = [{
                        'applicant_name_together_with':
                        data[j]['applicant_name_together_with']
                    }]
                    check_list_of_id1_str = self.getId(
                        '{ "data": ' + json.dumps(dict_applicant_name) + '}')
                    check_list_of_id1_dict = ast.literal_eval(
                        check_list_of_id1_str)
                    check_list_of_id1 = check_list_of_id1_dict['data'][0][
                        'applicant_id_together_with']
                    #print("check_list_of_id1 :",check_list_of_id1)
                    if len(check_list_of_id1
                           ) > 1 and check_list_of_id1[0] != 'NONE':
                        check_list_of_id1 = self.getCorrectSequence(
                            data[j]['applicant_id_together_with'],
                            check_list_of_id1)

                new_dict['applicant_id_together_with'] = check_list_of_id1

                new_dict[
                    'applicant_name_not_together_with'] = self.getCorrectSequence(
                        data[j]['applicant_name_not_together_with'],
                        backup_list_of_names)

                check_list_of_id2 = ['NONE']
                print("data[j]['applicant_id_not_together_with'] :",
                      data[j]['applicant_id_not_together_with'])
                if data[j]['applicant_id_not_together_with'] != '':
                    dict_applicant_name = [{
                        'applicant_name_not_together_with':
                        data[j]['applicant_name_not_together_with']
                    }]
                    check_list_of_id2_str = self.getId(
                        '{ "data": ' + json.dumps(dict_applicant_name) + '}')
                    check_list_of_id2_dict = ast.literal_eval(
                        check_list_of_id2_str)
                    check_list_of_id2 = check_list_of_id2_dict['data'][0][
                        'applicant_id_not_together_with']
                    #print("check_list_of_id1 :",check_list_of_id2)
                    if len(check_list_of_id2
                           ) > 1 and check_list_of_id2[0] != 'NONE':
                        check_list_of_id2 = self.getCorrectSequence(
                            data[j]['applicant_id_not_together_with'],
                            check_list_of_id2)

                new_dict['applicant_id_not_together_with'] = check_list_of_id2

                new_data.append(new_dict)

            return_front_end_dict = '{ "data": ' + json.dumps(
                new_data
            ) + ', "status":"success", "message":"All applicant' 's information retrieved" }'

        return return_front_end_dict