| 1 |
89.73 ms |
SELECT t0.id AS id_1, t0.firstName AS firstName_2, t0.lastName AS lastName_3, t0.similarName AS similarName_4, t0.maidenName AS maidenName_5, t0.gender AS gender_6, t0.membershipType AS membershipType_7, t0.advisor AS advisor_8, t0.school AS school_9, t0.college AS college_10, t0.completeCollegeUpdate AS completeCollegeUpdate_11, t0.highSchool1 AS highSchool1_12, t0.highSchool2 AS highSchool2_13, t0.seminary AS seminary_14, t0.dob AS dob_15, t0.ssn AS ssn_16, t0.jseId AS jseId_17, t0.cimId AS cimId_18, t0.email AS email_19, t0.address AS address_20, t0.city AS city_21, t0.state AS state_22, t0.zip AS zip_23, t0.country AS country_24, t0.phone AS phone_25, t0.phone2 AS phone2_26, t0.alert AS alert_27, t0.commenceNotes AS commenceNotes_28, t0.commenceAccountKey AS commenceAccountKey_29, t0.adminErrorDate AS adminErrorDate_30, t0.financialAid AS financialAid_31, t0.noTranscript AS noTranscript_32, t0.accommodations AS accommodations_33, t0.accommodationsApproved AS accommodationsApproved_34, t0.approvedBy AS approvedBy_35, t0.approvalDate AS approvalDate_36, t0.disAllowed AS disAllowed_37, t0.disAllowedComment AS disAllowedComment_38, t0.isIsraelStudent AS isIsraelStudent_39, t0.israelAddress AS israelAddress_40, t0.isapYear AS isapYear_41, t0.ttiStudentId AS ttiStudentId_42, t0.createdOn AS createdOn_43, t0.lastChange AS lastChange_44, t0.createdBy AS createdBy_45, t0.lastChangeBy AS lastChangeBy_46, t0.password AS password_47, t0.roles AS roles_48, t0.tal_guid AS tal_guid_49, t0.school_cohort AS school_cohort_50, t0.ccc_id AS ccc_id_51, t0.same_dob_ssn_counter AS same_dob_ssn_counter_52, t0.phone3 AS phone3_53, t0.phone4 AS phone4_54, t0.ccc_id_pending AS ccc_id_pending_55, t0.authnet_profile_updated AS authnet_profile_updated_56, t0.masped_student_id AS masped_student_id_57 FROM students t0 WHERE t0.email = ? LIMIT 1
Parameters: [
"sorsher@g.jct.ac.il"
]
SELECT
t0.id AS id_1,
t0.firstName AS firstName_2,
t0.lastName AS lastName_3,
t0.similarName AS similarName_4,
t0.maidenName AS maidenName_5,
t0.gender AS gender_6,
t0.membershipType AS membershipType_7,
t0.advisor AS advisor_8,
t0.school AS school_9,
t0.college AS college_10,
t0.completeCollegeUpdate AS completeCollegeUpdate_11,
t0.highSchool1 AS highSchool1_12,
t0.highSchool2 AS highSchool2_13,
t0.seminary AS seminary_14,
t0.dob AS dob_15,
t0.ssn AS ssn_16,
t0.jseId AS jseId_17,
t0.cimId AS cimId_18,
t0.email AS email_19,
t0.address AS address_20,
t0.city AS city_21,
t0.state AS state_22,
t0.zip AS zip_23,
t0.country AS country_24,
t0.phone AS phone_25,
t0.phone2 AS phone2_26,
t0.alert AS alert_27,
t0.commenceNotes AS commenceNotes_28,
t0.commenceAccountKey AS commenceAccountKey_29,
t0.adminErrorDate AS adminErrorDate_30,
t0.financialAid AS financialAid_31,
t0.noTranscript AS noTranscript_32,
t0.accommodations AS accommodations_33,
t0.accommodationsApproved AS accommodationsApproved_34,
t0.approvedBy AS approvedBy_35,
t0.approvalDate AS approvalDate_36,
t0.disAllowed AS disAllowed_37,
t0.disAllowedComment AS disAllowedComment_38,
t0.isIsraelStudent AS isIsraelStudent_39,
t0.israelAddress AS israelAddress_40,
t0.isapYear AS isapYear_41,
t0.ttiStudentId AS ttiStudentId_42,
t0.createdOn AS createdOn_43,
t0.lastChange AS lastChange_44,
t0.createdBy AS createdBy_45,
t0.lastChangeBy AS lastChangeBy_46,
t0.password AS password_47,
t0.roles AS roles_48,
t0.tal_guid AS tal_guid_49,
t0.school_cohort AS school_cohort_50,
t0.ccc_id AS ccc_id_51,
t0.same_dob_ssn_counter AS same_dob_ssn_counter_52,
t0.phone3 AS phone3_53,
t0.phone4 AS phone4_54,
t0.ccc_id_pending AS ccc_id_pending_55,
t0.authnet_profile_updated AS authnet_profile_updated_56,
t0.masped_student_id AS masped_student_id_57
FROM
students t0
WHERE
t0.email = ?
LIMIT
1
SELECT t0.id AS id_1, t0.firstName AS firstName_2, t0.lastName AS lastName_3, t0.similarName AS similarName_4, t0.maidenName AS maidenName_5, t0.gender AS gender_6, t0.membershipType AS membershipType_7, t0.advisor AS advisor_8, t0.school AS school_9, t0.college AS college_10, t0.completeCollegeUpdate AS completeCollegeUpdate_11, t0.highSchool1 AS highSchool1_12, t0.highSchool2 AS highSchool2_13, t0.seminary AS seminary_14, t0.dob AS dob_15, t0.ssn AS ssn_16, t0.jseId AS jseId_17, t0.cimId AS cimId_18, t0.email AS email_19, t0.address AS address_20, t0.city AS city_21, t0.state AS state_22, t0.zip AS zip_23, t0.country AS country_24, t0.phone AS phone_25, t0.phone2 AS phone2_26, t0.alert AS alert_27, t0.commenceNotes AS commenceNotes_28, t0.commenceAccountKey AS commenceAccountKey_29, t0.adminErrorDate AS adminErrorDate_30, t0.financialAid AS financialAid_31, t0.noTranscript AS noTranscript_32, t0.accommodations AS accommodations_33, t0.accommodationsApproved AS accommodationsApproved_34, t0.approvedBy AS approvedBy_35, t0.approvalDate AS approvalDate_36, t0.disAllowed AS disAllowed_37, t0.disAllowedComment AS disAllowedComment_38, t0.isIsraelStudent AS isIsraelStudent_39, t0.israelAddress AS israelAddress_40, t0.isapYear AS isapYear_41, t0.ttiStudentId AS ttiStudentId_42, t0.createdOn AS createdOn_43, t0.lastChange AS lastChange_44, t0.createdBy AS createdBy_45, t0.lastChangeBy AS lastChangeBy_46, t0.password AS password_47, t0.roles AS roles_48, t0.tal_guid AS tal_guid_49, t0.school_cohort AS school_cohort_50, t0.ccc_id AS ccc_id_51, t0.same_dob_ssn_counter AS same_dob_ssn_counter_52, t0.phone3 AS phone3_53, t0.phone4 AS phone4_54, t0.ccc_id_pending AS ccc_id_pending_55, t0.authnet_profile_updated AS authnet_profile_updated_56, t0.masped_student_id AS masped_student_id_57 FROM students t0 WHERE t0.email = 'sorsher@g.jct.ac.il' LIMIT 1;
|
| 2 |
491.62 ms |
select e.id,e.secularNumber ,e.secularTitle,e.subject, if((select id from exams e1 where e1.secularNumber like concat(REPLACE(e.secularNumber,' Course',''),' %') and e1.alternate_course_version = 1 and e1.active =1 and e.id != e1.id and e1.vendor_id=e.vendor_id),1,0) as hasAlternateCourseVersion,e.credits,e.duration as examDuration, e.allowed_resources, e.online_only,e.paper_only,e.assignments,e.alt1,e.alt2,e.alt3,e.program_content_code,
e.alternate_course_version, ac.course_id ampeducator_course_id, v.name as vendor_name,
e.additionalCharge,e.phonesystem_active,e.content_code,
v.fullname as vendor_fullname,v.phone as vendor_phone, v.student_support_email as vendor_student_support_email, v.id as vendor_id,
re.id as registration_id,re.sessionType,
re.online_ampeducator_assignments_started, re.online_ampeducator_assignments_completed,
if(sid.id,1,0) as isFreeSchoolRegistration,
if((re.testSessionId and re.onlineAccess is null),ifnull(ts.date,ts.returnDueDate),ifnull(re.online_exam_completed, re.online_exam_started)) as examTakenDate,
re.online_exam_completed, re.exam_to_course,
if(
(
(
(re.gradedOn or
(re.arrivedBack or re.online_exam_completed or re.online_exam_started <= DATE_SUB(now(), INTERVAL 1 DAY))
and if(e.vendor_id = 3 and e.assignments = 1, if(re.online_ampeducator_assignments_completed is not null,1,null),1)
)
or (re.online_exam_started is null and re.online_program_started is null and re.online_ampeducator_assignments_started is null and (select t.closedOn from talBatches t where re.batchId = t.id ))
or (re.exam_to_course =1 and re.online_program_completed is not null)
)
and
(re.online_exam_taken_override is null OR (DATE_ADD(re.online_exam_taken_override, INTERVAL 1 DAY) < now()))),1,null) as examTaken,
if(e.vendor_id = 3 and e.assignments = 1 and (re.online_exam_completed or (re.online_exam_started <= DATE_SUB(now(), INTERVAL 1 DAY) && (re.online_exam_taken_override is null OR (DATE_ADD(re.online_exam_taken_override, INTERVAL 1 DAY) < now()))) or re.arrivedBack) and re.grade is null,1,null) coopersmithExamTakenAssignmentsIncomplete,
re.onlineAccess,re.online_exam_redirect, re.online_exam_started,
re.admin_cancel_session_id, re.admin_cancel_session_reason_code, re.admin_cancel_session_date,
re.testSessionId as testSessionId, ts.date as paperBasedExamDate,
re.grade,re.gradeComment,re.vendor_approved_retake,re.vendor_approved_retake_with_fee,
re.proctor_fee_price, re.proctor_reserved,re.online_program_redirect,re.proctorUuid,re.online_program_started,re.online_program_completed,
isOldSystemReg.id as isOldSystemReg,
l.branchId,schoolReg.pricePerCredit as schoolRegPricePerCredit,schoolReg.chargeSchool,
(select if((count(*)>1),
group_concat(concat((if((r1.testSessionId and r1.onlineAccess is null),ifnull(ts1.date,ts1.returnDueDate),ifnull(r1.online_exam_completed, ifnull(r1.online_exam_started,if(r1.grade,'0000-00-00',null)))))),'*',ifnull(r1.grade,0),'*',ifnull(r1.gradeComment,'')),0)
from registrations r1
left join testSessions ts1 on ts1.id = r1.testSessionId
where r1.studentId = :student_id and r1.active = 1 and r1.examId=re.examId)
as is_retake_dates,
if(esm.url is not null,true,null) as study_materials,
(if((package.student_id),
(find_in_set(e.vendor_id,vendors_allowed) or find_in_set(e.id,exams_allowed)),
((((s.gender = 1 or (s.college IN (269,253,283) and e.secularNumber not like 'Talmud%')) and (v.id in (1,4) OR (v.id = 3 and tti_allow =1 ))) OR (s.gender =2 and (s.college not IN (269,253,283) or s.college is null) AND (v.id in (1,3) OR (v.id = 4 and e.tti_allow =1 ) ) and (e.secularNumber not like 'Talmud%')) and e.active = 1)))
and if(s.college NOT IN (269) or s.college is null,e.alternate_course_version is not true,true))
as fitRequirements, package.vendors_allowed, package.exams_allowed ,
if((select pt.id from pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where pt.registrations_id = re.id and pt.transaction_type = 'R' and ppt.no_additional_fees = 1 limit 1) &&
((select count(ptp.id) from pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where pt.registrations_id = re.id and pt.transaction_type = 'R' and (ppt.no_additional_fees is null or ppt.no_additional_fees =0) and pt.credit_amount > 0) =0),1,0) as isFreeAdditionnalFees,
if((select pt.id from pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where pt.registrations_id = re.id and pt.transaction_type = 'R' and ppt.no_additional_fees = 1 limit 1) &&
(select count(ptp.id) from pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where pt.registrations_id = re.id and pt.transaction_type = 'R' and (ppt.no_additional_fees is null or ppt.no_additional_fees =0) and pt.credit_amount > 0) =0,0,
if(((ifnull(e.additionalCharge,0) > 0) && re.proctor_reserved is null && ifnull(!(select id from charges c where c.registrationId = re.id and c.studentId = :student_id and c.chargeTypeId in (select id from chargeTypes ct where ct.additional_fee_included = 1) limit 1),1)),1,0)) as chargeAdditionalCharge
from exams e
join vendors v on e.vendor_id = v.id
join (select gender,college from students where id = :student_id) as s
left join ampeducator_courses ac on
(e.secularNumber = ac.course_code and e.vendor_id = 3 and e.active = 1 and e.assignments = 1 and ac.section = '')
left join
(select max(id) id,examId,studentId
from registrations r where r.studentId = :student_id and r.active =1
group by examId, studentId) re1 on (re1.examId = e.id)
left join (select p.student_id,group_concat(ppt.vendors_allowed) as vendors_allowed, group_concat(ppt.exams_allowed) as exams_allowed
from pck_packages p
join pck_packagetypes ppt
on ppt.id = p.package_types_id
where p.student_id = :student_id and p.active = 1 and p.credit_balance > 0
and (ppt.exams_allowed or ppt.vendors_allowed )) as package on package.student_id = :student_id
left join
(select * from charges c where c.chargeTypeId = 1 and c.studentId = :student_id )
isOldSystemReg on (isOldSystemReg.registrationId = re1.id)
left join school_invoice_details sid on sid.registration_id = re1.id
left join registrations re on re1.id = re.id
left join testSessions ts on (re.testSessionId = ts.id)
left join (select if(student.membershipType = 1,s.member_pricePerCredit,s.nonmember_pricePerCredit) as pricePerCredit,reg.id as registrationId ,s.chargeSchool
from schools s
left join testSessions ts on ts.schoolId = s.id
left join registrations reg on reg.testSessionId = ts.id
left join students student on student.id = reg.studentId
where reg.sessionType = 22) schoolReg on schoolReg.registrationId = re1.id
left join locations l on l.id = ts.locationId
left join (select exam_id, min(url) url from exam_study_materials group by exam_id) esm on esm.exam_id = e.id
where (e.active = 1
and if(s.college NOT IN (269) or s.college is null,e.alternate_course_version is not true,true)
and if((package.student_id),
(find_in_set(e.vendor_id,vendors_allowed) or find_in_set(e.id,exams_allowed)),
(( (s.gender = 1 or (s.college IN (269,253,283) and e.secularNumber not like 'Talmud%')) and (v.id in (1,4) OR (v.id = 3 and tti_allow =1 )) and e.phonesystem_active = 1 ) OR (s.gender =2 and (s.college NOT IN (269,253,283) or s.college is null) AND (v.id in (1,3) OR (v.id = 4 and e.tti_allow =1 )) and (e.secularNumber not like 'Talmud%') and e.phonesystem_active = 1 ))))
OR re.id
order by e.subject ASC
Parameters: [
"student_id" => 19922
]
select
e.id,
e.secularNumber,
e.secularTitle,
e.subject,
if(
(
select
id
from
exams e1
where
e1.secularNumber like concat(
REPLACE(e.secularNumber, ' Course', ''),
' %'
)
and e1.alternate_course_version = 1
and e1.active = 1
and e.id != e1.id
and e1.vendor_id = e.vendor_id
),
1,
0
) as hasAlternateCourseVersion,
e.credits,
e.duration as examDuration,
e.allowed_resources,
e.online_only,
e.paper_only,
e.assignments,
e.alt1,
e.alt2,
e.alt3,
e.program_content_code,
e.alternate_course_version,
ac.course_id ampeducator_course_id,
v.name as vendor_name,
e.additionalCharge,
e.phonesystem_active,
e.content_code,
v.fullname as vendor_fullname,
v.phone as vendor_phone,
v.student_support_email as vendor_student_support_email,
v.id as vendor_id,
re.id as registration_id,
re.sessionType,
re.online_ampeducator_assignments_started,
re.online_ampeducator_assignments_completed,
if(sid.id, 1, 0) as isFreeSchoolRegistration,
if(
(
re.testSessionId
and re.onlineAccess is null
),
ifnull(ts.date, ts.returnDueDate),
ifnull(
re.online_exam_completed, re.online_exam_started
)
) as examTakenDate,
re.online_exam_completed,
re.exam_to_course,
if(
(
(
(
re.gradedOn
or (
re.arrivedBack
or re.online_exam_completed
or re.online_exam_started <= DATE_SUB(
now(),
INTERVAL 1 DAY
)
)
and if(
e.vendor_id = 3
and e.assignments = 1,
if(
re.online_ampeducator_assignments_completed is not null,
1, null
),
1
)
)
or (
re.online_exam_started is null
and re.online_program_started is null
and re.online_ampeducator_assignments_started is null
and (
select
t.closedOn
from
talBatches t
where
re.batchId = t.id
)
)
or (
re.exam_to_course = 1
and re.online_program_completed is not null
)
)
and (
re.online_exam_taken_override is null
OR (
DATE_ADD(
re.online_exam_taken_override, INTERVAL 1 DAY
) < now()
)
)
),
1,
null
) as examTaken,
if(
e.vendor_id = 3
and e.assignments = 1
and (
re.online_exam_completed
or (
re.online_exam_started <= DATE_SUB(
now(),
INTERVAL 1 DAY
) && (
re.online_exam_taken_override is null
OR (
DATE_ADD(
re.online_exam_taken_override, INTERVAL 1 DAY
) < now()
)
)
)
or re.arrivedBack
)
and re.grade is null,
1,
null
) coopersmithExamTakenAssignmentsIncomplete,
re.onlineAccess,
re.online_exam_redirect,
re.online_exam_started,
re.admin_cancel_session_id,
re.admin_cancel_session_reason_code,
re.admin_cancel_session_date,
re.testSessionId as testSessionId,
ts.date as paperBasedExamDate,
re.grade,
re.gradeComment,
re.vendor_approved_retake,
re.vendor_approved_retake_with_fee,
re.proctor_fee_price,
re.proctor_reserved,
re.online_program_redirect,
re.proctorUuid,
re.online_program_started,
re.online_program_completed,
isOldSystemReg.id as isOldSystemReg,
l.branchId,
schoolReg.pricePerCredit as schoolRegPricePerCredit,
schoolReg.chargeSchool,
(
select
if(
(
count(*)> 1
),
group_concat(
concat(
(
if(
(
r1.testSessionId
and r1.onlineAccess is null
),
ifnull(ts1.date, ts1.returnDueDate),
ifnull(
r1.online_exam_completed,
ifnull(
r1.online_exam_started,
if(r1.grade, '0000-00-00', null)
)
)
)
)
),
'*',
ifnull(r1.grade, 0),
'*',
ifnull(r1.gradeComment, '')
),
0
)
from
registrations r1
left join testSessions ts1 on ts1.id = r1.testSessionId
where
r1.studentId = :student_id
and r1.active = 1
and r1.examId = re.examId
) as is_retake_dates,
if(esm.url is not null, true, null) as study_materials,
(
if(
(package.student_id),
(
find_in_set(e.vendor_id, vendors_allowed)
or find_in_set(e.id, exams_allowed)
),
(
(
(
(
s.gender = 1
or (
s.college IN (269, 253, 283)
and e.secularNumber not like 'Talmud%'
)
)
and (
v.id in (1, 4)
OR (
v.id = 3
and tti_allow = 1
)
)
)
OR (
s.gender = 2
and (
s.college not IN (269, 253, 283)
or s.college is null
)
AND (
v.id in (1, 3)
OR (
v.id = 4
and e.tti_allow = 1
)
)
and (
e.secularNumber not like 'Talmud%'
)
)
and e.active = 1
)
)
)
and if(
s.college NOT IN (269)
or s.college is null,
e.alternate_course_version is not true,
true
)
) as fitRequirements,
package.vendors_allowed,
package.exams_allowed,
if(
(
select
pt.id
from
pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where
pt.registrations_id = re.id
and pt.transaction_type = 'R'
and ppt.no_additional_fees = 1
limit
1
) && (
(
select
count(ptp.id)
from
pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where
pt.registrations_id = re.id
and pt.transaction_type = 'R'
and (
ppt.no_additional_fees is null
or ppt.no_additional_fees = 0
)
and pt.credit_amount > 0
) = 0
),
1,
0
) as isFreeAdditionnalFees,
if(
(
select
pt.id
from
pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where
pt.registrations_id = re.id
and pt.transaction_type = 'R'
and ppt.no_additional_fees = 1
limit
1
) && (
select
count(ptp.id)
from
pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where
pt.registrations_id = re.id
and pt.transaction_type = 'R'
and (
ppt.no_additional_fees is null
or ppt.no_additional_fees = 0
)
and pt.credit_amount > 0
) = 0,
0,
if(
(
(
ifnull(e.additionalCharge, 0) > 0
) && re.proctor_reserved is null && ifnull(
!(
select
id
from
charges c
where
c.registrationId = re.id
and c.studentId = :student_id
and c.chargeTypeId in (
select
id
from
chargeTypes ct
where
ct.additional_fee_included = 1
)
limit
1
), 1
)
),
1,
0
)
) as chargeAdditionalCharge
from
exams e
join vendors v on e.vendor_id = v.id
join (
select
gender,
college
from
students
where
id = :student_id
) as s
left join ampeducator_courses ac on (
e.secularNumber = ac.course_code
and e.vendor_id = 3
and e.active = 1
and e.assignments = 1
and ac.section = ''
)
left join (
select
max(id) id,
examId,
studentId
from
registrations r
where
r.studentId = :student_id
and r.active = 1
group by
examId,
studentId
) re1 on (re1.examId = e.id)
left join (
select
p.student_id,
group_concat(ppt.vendors_allowed) as vendors_allowed,
group_concat(ppt.exams_allowed) as exams_allowed
from
pck_packages p
join pck_packagetypes ppt on ppt.id = p.package_types_id
where
p.student_id = :student_id
and p.active = 1
and p.credit_balance > 0
and (
ppt.exams_allowed
or ppt.vendors_allowed
)
) as package on package.student_id = :student_id
left join (
select
*
from
charges c
where
c.chargeTypeId = 1
and c.studentId = :student_id
) isOldSystemReg on (
isOldSystemReg.registrationId = re1.id
)
left join school_invoice_details sid on sid.registration_id = re1.id
left join registrations re on re1.id = re.id
left join testSessions ts on (re.testSessionId = ts.id)
left join (
select
if(
student.membershipType = 1, s.member_pricePerCredit,
s.nonmember_pricePerCredit
) as pricePerCredit,
reg.id as registrationId,
s.chargeSchool
from
schools s
left join testSessions ts on ts.schoolId = s.id
left join registrations reg on reg.testSessionId = ts.id
left join students student on student.id = reg.studentId
where
reg.sessionType = 22
) schoolReg on schoolReg.registrationId = re1.id
left join locations l on l.id = ts.locationId
left join (
select
exam_id,
min(url) url
from
exam_study_materials
group by
exam_id
) esm on esm.exam_id = e.id
where
(
e.active = 1
and if(
s.college NOT IN (269)
or s.college is null,
e.alternate_course_version is not true,
true
)
and if(
(package.student_id),
(
find_in_set(e.vendor_id, vendors_allowed)
or find_in_set(e.id, exams_allowed)
),
(
(
(
s.gender = 1
or (
s.college IN (269, 253, 283)
and e.secularNumber not like 'Talmud%'
)
)
and (
v.id in (1, 4)
OR (
v.id = 3
and tti_allow = 1
)
)
and e.phonesystem_active = 1
)
OR (
s.gender = 2
and (
s.college NOT IN (269, 253, 283)
or s.college is null
)
AND (
v.id in (1, 3)
OR (
v.id = 4
and e.tti_allow = 1
)
)
and (
e.secularNumber not like 'Talmud%'
)
and e.phonesystem_active = 1
)
)
)
)
OR re.id
order by
e.subject ASC
select e.id,e.secularNumber ,e.secularTitle,e.subject, if((select id from exams e1 where e1.secularNumber like concat(REPLACE(e.secularNumber,' Course',''),' %') and e1.alternate_course_version = 1 and e1.active =1 and e.id != e1.id and e1.vendor_id=e.vendor_id),1,0) as hasAlternateCourseVersion,e.credits,e.duration as examDuration, e.allowed_resources, e.online_only,e.paper_only,e.assignments,e.alt1,e.alt2,e.alt3,e.program_content_code,
e.alternate_course_version, ac.course_id ampeducator_course_id, v.name as vendor_name,
e.additionalCharge,e.phonesystem_active,e.content_code,
v.fullname as vendor_fullname,v.phone as vendor_phone, v.student_support_email as vendor_student_support_email, v.id as vendor_id,
re.id as registration_id,re.sessionType,
re.online_ampeducator_assignments_started, re.online_ampeducator_assignments_completed,
if(sid.id,1,0) as isFreeSchoolRegistration,
if((re.testSessionId and re.onlineAccess is null),ifnull(ts.date,ts.returnDueDate),ifnull(re.online_exam_completed, re.online_exam_started)) as examTakenDate,
re.online_exam_completed, re.exam_to_course,
if(
(
(
(re.gradedOn or
(re.arrivedBack or re.online_exam_completed or re.online_exam_started <= DATE_SUB(now(), INTERVAL 1 DAY))
and if(e.vendor_id = 3 and e.assignments = 1, if(re.online_ampeducator_assignments_completed is not null,1,null),1)
)
or (re.online_exam_started is null and re.online_program_started is null and re.online_ampeducator_assignments_started is null and (select t.closedOn from talBatches t where re.batchId = t.id ))
or (re.exam_to_course =1 and re.online_program_completed is not null)
)
and
(re.online_exam_taken_override is null OR (DATE_ADD(re.online_exam_taken_override, INTERVAL 1 DAY) < now()))),1,null) as examTaken,
if(e.vendor_id = 3 and e.assignments = 1 and (re.online_exam_completed or (re.online_exam_started <= DATE_SUB(now(), INTERVAL 1 DAY) && (re.online_exam_taken_override is null OR (DATE_ADD(re.online_exam_taken_override, INTERVAL 1 DAY) < now()))) or re.arrivedBack) and re.grade is null,1,null) coopersmithExamTakenAssignmentsIncomplete,
re.onlineAccess,re.online_exam_redirect, re.online_exam_started,
re.admin_cancel_session_id, re.admin_cancel_session_reason_code, re.admin_cancel_session_date,
re.testSessionId as testSessionId, ts.date as paperBasedExamDate,
re.grade,re.gradeComment,re.vendor_approved_retake,re.vendor_approved_retake_with_fee,
re.proctor_fee_price, re.proctor_reserved,re.online_program_redirect,re.proctorUuid,re.online_program_started,re.online_program_completed,
isOldSystemReg.id as isOldSystemReg,
l.branchId,schoolReg.pricePerCredit as schoolRegPricePerCredit,schoolReg.chargeSchool,
(select if((count(*)>1),
group_concat(concat((if((r1.testSessionId and r1.onlineAccess is null),ifnull(ts1.date,ts1.returnDueDate),ifnull(r1.online_exam_completed, ifnull(r1.online_exam_started,if(r1.grade,'0000-00-00',null)))))),'*',ifnull(r1.grade,0),'*',ifnull(r1.gradeComment,'')),0)
from registrations r1
left join testSessions ts1 on ts1.id = r1.testSessionId
where r1.studentId = 19922 and r1.active = 1 and r1.examId=re.examId)
as is_retake_dates,
if(esm.url is not null,true,null) as study_materials,
(if((package.student_id),
(find_in_set(e.vendor_id,vendors_allowed) or find_in_set(e.id,exams_allowed)),
((((s.gender = 1 or (s.college IN (269,253,283) and e.secularNumber not like 'Talmud%')) and (v.id in (1,4) OR (v.id = 3 and tti_allow =1 ))) OR (s.gender =2 and (s.college not IN (269,253,283) or s.college is null) AND (v.id in (1,3) OR (v.id = 4 and e.tti_allow =1 ) ) and (e.secularNumber not like 'Talmud%')) and e.active = 1)))
and if(s.college NOT IN (269) or s.college is null,e.alternate_course_version is not true,true))
as fitRequirements, package.vendors_allowed, package.exams_allowed ,
if((select pt.id from pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where pt.registrations_id = re.id and pt.transaction_type = 'R' and ppt.no_additional_fees = 1 limit 1) &&
((select count(ptp.id) from pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where pt.registrations_id = re.id and pt.transaction_type = 'R' and (ppt.no_additional_fees is null or ppt.no_additional_fees =0) and pt.credit_amount > 0) =0),1,0) as isFreeAdditionnalFees,
if((select pt.id from pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where pt.registrations_id = re.id and pt.transaction_type = 'R' and ppt.no_additional_fees = 1 limit 1) &&
(select count(ptp.id) from pck_transactions pt
join pck_transactions_packages ptp on ptp.pck_transactions_id = pt.id
join pck_packages pp on pp.id = ptp.pck_packages_id
join pck_packagetypes ppt on ppt.id = pp.package_types_id
where pt.registrations_id = re.id and pt.transaction_type = 'R' and (ppt.no_additional_fees is null or ppt.no_additional_fees =0) and pt.credit_amount > 0) =0,0,
if(((ifnull(e.additionalCharge,0) > 0) && re.proctor_reserved is null && ifnull(!(select id from charges c where c.registrationId = re.id and c.studentId = 19922 and c.chargeTypeId in (select id from chargeTypes ct where ct.additional_fee_included = 1) limit 1),1)),1,0)) as chargeAdditionalCharge
from exams e
join vendors v on e.vendor_id = v.id
join (select gender,college from students where id = 19922) as s
left join ampeducator_courses ac on
(e.secularNumber = ac.course_code and e.vendor_id = 3 and e.active = 1 and e.assignments = 1 and ac.section = '')
left join
(select max(id) id,examId,studentId
from registrations r where r.studentId = 19922 and r.active =1
group by examId, studentId) re1 on (re1.examId = e.id)
left join (select p.student_id,group_concat(ppt.vendors_allowed) as vendors_allowed, group_concat(ppt.exams_allowed) as exams_allowed
from pck_packages p
join pck_packagetypes ppt
on ppt.id = p.package_types_id
where p.student_id = 19922 and p.active = 1 and p.credit_balance > 0
and (ppt.exams_allowed or ppt.vendors_allowed )) as package on package.student_id = 19922
left join
(select * from charges c where c.chargeTypeId = 1 and c.studentId = 19922 )
isOldSystemReg on (isOldSystemReg.registrationId = re1.id)
left join school_invoice_details sid on sid.registration_id = re1.id
left join registrations re on re1.id = re.id
left join testSessions ts on (re.testSessionId = ts.id)
left join (select if(student.membershipType = 1,s.member_pricePerCredit,s.nonmember_pricePerCredit) as pricePerCredit,reg.id as registrationId ,s.chargeSchool
from schools s
left join testSessions ts on ts.schoolId = s.id
left join registrations reg on reg.testSessionId = ts.id
left join students student on student.id = reg.studentId
where reg.sessionType = 22) schoolReg on schoolReg.registrationId = re1.id
left join locations l on l.id = ts.locationId
left join (select exam_id, min(url) url from exam_study_materials group by exam_id) esm on esm.exam_id = e.id
where (e.active = 1
and if(s.college NOT IN (269) or s.college is null,e.alternate_course_version is not true,true)
and if((package.student_id),
(find_in_set(e.vendor_id,vendors_allowed) or find_in_set(e.id,exams_allowed)),
(( (s.gender = 1 or (s.college IN (269,253,283) and e.secularNumber not like 'Talmud%')) and (v.id in (1,4) OR (v.id = 3 and tti_allow =1 )) and e.phonesystem_active = 1 ) OR (s.gender =2 and (s.college NOT IN (269,253,283) or s.college is null) AND (v.id in (1,3) OR (v.id = 4 and e.tti_allow =1 )) and (e.secularNumber not like 'Talmud%') and e.phonesystem_active = 1 ))))
OR re.id
order by e.subject ASC;
|