Skip to content

Commit

Permalink
Merge pull request #584 from ozamani9/pest_changes1
Browse files Browse the repository at this point in the history
Pesticide THW Changes
  • Loading branch information
jhmccoll authored May 14, 2021
2 parents 9779009 + 08c9ce6 commit 8984175
Show file tree
Hide file tree
Showing 17 changed files with 23,811 additions and 67 deletions.
4 changes: 2 additions & 2 deletions api/app/admin/csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def can_create(self):
'username': 'Username',
'office.office_name': 'Office',
'office_manager': 'Office Exam Manager',
'pesticide_designate': 'Pesticide Client Liaison/Program Specialist',
'pesticide_designate': 'Environment Client Liaison/Program Specialist',
'finance_designate': 'Financial Reporting Designate',
'ita2_designate': 'ITA Liaison/Program Specialist',
'role.role_desc': 'Role',
Expand All @@ -70,7 +70,7 @@ def can_create(self):
("0", 'No - not an Exam Manager'), ("1", 'Yes - an Exam Manager')
],
'pesticide_designate': [
("0", 'No - not a Pesticide Specialist'), ("1", 'Yes - a Pesticide Specialist')
("0", 'No - not an Environment Specialist'), ("1", 'Yes - an Environment Specialist')
],
'finance_designate': [
("0", 'No - not in Finance team'), ("1", 'Yes - for Finance team reporting')
Expand Down
6 changes: 3 additions & 3 deletions api/app/admin/examtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_query(self):
'method_type': 'Method Type',
'ita_ind': 'ITA Exam Flag',
'group_exam_ind': 'Group Exam Flag',
'pesticide_exam_ind': 'Pesticide Exam Flag',
'pesticide_exam_ind': 'Environment Exam Flag',
}

column_searchable_list = {'exam_type_name'}
Expand Down Expand Up @@ -77,7 +77,7 @@ def get_query(self):
'method_type': 'Method Type',
'ita_ind': 'ITA Exam Flag',
'group_exam_ind': 'Group Exam Flag',
'pesticide_exam_ind': 'Pesticide Exam Flag',
'pesticide_exam_ind': 'Environment Exam Flag',
}
form_choices = {
'ita_ind': [
Expand All @@ -87,7 +87,7 @@ def get_query(self):
("0", 'No - this is not a Group exam'), ("1", 'Yes - this is a Group exam')
],
'pesticide_exam_ind': [
("0", 'No - this is not a Pesticide exam'), ("1", 'Yes - this is a Pesticide exam')
("0", 'No - this is not an Environment exam'), ("1", 'Yes - this is an Environment exam')
]
}

Expand Down
2 changes: 1 addition & 1 deletion api/app/resources/bookings/exam/exam_bcmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def post(self):

else:

logging.info("Creating Group pesticide exam")
logging.info("Creating Group Environment exam")
bcmp_response = self.bcmp_service.create_group_exam_bcmp(exam, booking, formatted_data["candidates_list_bcmp"], invigilator, formatted_data["pesticide_office"], g.jwt_oidc_token_info)


Expand Down
2 changes: 1 addition & 1 deletion api/app/resources/bookings/exam/exam_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def format_data(self, json_data, exam):
else:
logging.info("For Group Exams")

exam_type = ExamType.query.filter_by(exam_type_name="Group Pesticide Exam").first()
exam_type = ExamType.query.filter_by(exam_type_name="Group Environment Exam").first()
if exam_type:
exam.exam_type_id = exam_type.exam_type_id
exam.exam_type = exam_type
Expand Down
26 changes: 18 additions & 8 deletions api/app/utilities/bcmp_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class BCMPService:
base_url = application.config['BCMP_BASE_URL']
auth_token = application.config['BCMP_AUTH_TOKEN']
bcmp_user = application.config["BCMP_USER"]

def __init__(self):
return
Expand Down Expand Up @@ -45,7 +46,8 @@ def send_request(self, path, method, data):
return False

def check_exam_status(self, exam):
url = "%s/auth=env_exam;%s/JSON/status" % (self.base_url, self.auth_token)
url = "%s/auth=%s;%s/JSON/status" % (self.base_url, self.bcmp_user, self.auth_token)
my_print(" ==> check_exam_status url: %s" % url)
data = {
"jobs": [
exam.bcmp_job_id
Expand All @@ -62,7 +64,8 @@ def check_exam_status(self, exam):
return False

def bulk_check_exam_status(self, exams):
url = "%s/auth=env_exam;%s/JSON/status" % (self.base_url, self.auth_token)
url = "%s/auth=%s;%s/JSON/status" % (self.base_url, self.bcmp_user, self.auth_token)
my_print(" ==> bulk_check_exam_status url: %s" % url)
data = {
"jobs": []
}
Expand All @@ -76,7 +79,11 @@ def bulk_check_exam_status(self, exams):
return response

def create_individual_exam(self, exam, exam_fees, invigilator, pesticide_office, oidc_token_info):
url = "%s/auth=env_exam;%s/JSON/create:ENV-IPM-EXAM" % (self.base_url, self.auth_token)
my_print(" ==> create_individual_exam self base_url: %s" % self.base_url)
my_print(" ==> create_individual_exam self bcmp_user: %s" % self.bcmp_user)
my_print(" ==> create_individual_exam self auth_token: %s" % self.auth_token)
url = "%s/auth=%s;%s/JSON/create:BCMD-EXAM" % (self.base_url, self.bcmp_user, self.auth_token)
my_print(" ==> create_individual_exam url: %s" % url)

office_name = None
if pesticide_office:
Expand Down Expand Up @@ -117,8 +124,8 @@ def create_individual_exam(self, exam, exam_fees, invigilator, pesticide_office,
return response

def create_group_exam_bcmp(self, exam, booking, candiate_list, invigilator, pesticide_office, oidc_token_info):
url = "%s/auth=env_exam;%s/JSON/create:ENV-IPM-EXAM-GROUP" % (self.base_url, self.auth_token)

url = "%s/auth=%s;%s/JSON/create:BCMD-EXAM-GROUP" % (self.base_url, self.bcmp_user, self.auth_token)
my_print(" ==> create_group_exam_bcmp url: %s" % url)
invigilator_name = None
if invigilator:
invigilator_name = invigilator.invigilator_name
Expand Down Expand Up @@ -169,7 +176,8 @@ def create_group_exam_bcmp(self, exam, booking, candiate_list, invigilator, pest
return response

def create_group_exam(self, exam):
url = "%s/auth=env_exam;%s/JSON/create:ENV-IPM-EXAM" % (self.base_url, self.auth_token)
url = "%s/auth=%s;%s/JSON/create:BCMD-EXAM" % (self.base_url, self.bcmp_user, self.auth_token)
my_print(" ==> create_group_exam url: %s" % url)

bcmp_exam = {
"students": []
Expand All @@ -182,7 +190,8 @@ def create_group_exam(self, exam):
return response

def send_exam_to_bcmp(self, exam):
url = "%s/auth=env_exam;%s/JSON/create:ENV-IPM-EXAM-API-ACTION" % (self.base_url, self.auth_token)
url = "%s/auth=%s;%s/JSON/create:BCMD-EXAM-API-ACTION" % (self.base_url, self.bcmp_user, self.auth_token)
my_print(" ==> send_exam_to_bcmp url: %s" % url)

client = DocumentService(
application.config["MINIO_HOST"],
Expand All @@ -207,7 +216,8 @@ def send_exam_to_bcmp(self, exam):
return response

def email_exam_invigilator(self, exam, invigilator_name, invigilator_email, invigilator_phone):
url = "%s/auth=env_exam;%s/JSON/create:ENV-IPM-EXAM-API-ACTION" % (self.base_url, self.auth_token)
url = "%s/auth=%s;%s/JSON/create:BCMD-EXAM-API-ACTION" % (self.base_url, self.bcmp_user, self.auth_token)
my_print(" ==> email_exam_invigilator url: %s" % url)

json_data = {
"action": {
Expand Down
5 changes: 5 additions & 0 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ class LocalConfig(BaseConfig):
)
BCMP_BASE_URL = os.getenv('BCMP_BASE_URL')
BCMP_AUTH_TOKEN = os.getenv('BCMP_AUTH_TOKEN')
BCMP_USER = os.getenv('BCMP_USER')


MINIO_HOST = os.getenv('MINIO_HOST', 'localhost:9000')
MINIO_BUCKET = os.getenv('MINIO_BUCKET', 'exams')
Expand All @@ -281,6 +283,7 @@ class DevelopmentConfig(BaseConfig):
PREFERRED_URL_SCHEME = 'https'
BCMP_BASE_URL = os.getenv('BCMP_BASE_URL')
BCMP_AUTH_TOKEN = os.getenv('BCMP_AUTH_TOKEN')
BCMP_USER = os.getenv('BCMP_USER')


class TestConfig(BaseConfig):
Expand All @@ -292,6 +295,7 @@ class TestConfig(BaseConfig):
PREFERRED_URL_SCHEME = 'https'
BCMP_BASE_URL = os.getenv('BCMP_BASE_URL')
BCMP_AUTH_TOKEN = os.getenv('BCMP_AUTH_TOKEN')
BCMP_USER = os.getenv('BCMP_USER')


class ProductionConfig(BaseConfig):
Expand All @@ -303,6 +307,7 @@ class ProductionConfig(BaseConfig):
PREFERRED_URL_SCHEME = 'https'
BCMP_BASE_URL = os.getenv('BCMP_BASE_URL')
BCMP_AUTH_TOKEN = os.getenv('BCMP_AUTH_TOKEN')
BCMP_USER = os.getenv('BCMP_USER')


def configure_app(app):
Expand Down
2 changes: 1 addition & 1 deletion api/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ def run(self):
)

exam_type_twenty_four = bookings.ExamType(
exam_type_name="Group Pesticide Exam",
exam_type_name="Group Environment Exam",
exam_color="#FFFFFF",
number_of_hours=0,
method_type="written",
Expand Down
2 changes: 1 addition & 1 deletion api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ flask-restx
# with inviting Citizens expected to be fixed with Release 1.3.14
SQLAlchemy<1.4
snowplow-tracker
Flask
Flask==1.1.2
Flask-Admin
Flask-Cache
Flask-Login
Expand Down
69 changes: 39 additions & 30 deletions appointment-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8984175

Please sign in to comment.