Skip to content

Commit

Permalink
feature/58889 - Hide attendance codes (#2500)
Browse files Browse the repository at this point in the history
* hide absent attendance code

* remove absent reason

---------

Co-authored-by: Mohsen Qureshi <[email protected]>
  • Loading branch information
GuyHarwood and activemq authored May 3, 2023
1 parent 0034c3b commit 9ebb24e
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 21 deletions.
4 changes: 2 additions & 2 deletions admin/controllers/pupils-not-taking-the-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const businessAvailabilityService = require('../services/business-availability.s
const checkWindowPhaseConsts = require('../lib/consts/check-window-phase')

/**
* Pupils not taking the check: initial page.
* Pupils not taking the check: lists any pupils with attendance set.
* @param req
* @param res
* @param next
Expand Down Expand Up @@ -51,7 +51,7 @@ const getPupilNotTakingCheck = async function getPupilNotTakingCheck (req, res,
}

/**
* Pupils not taking the check: pupil selection to add a new reason or change a reason
* Pupils not taking the check: pupil selection to add a new reason or remove a reason
* @param req
* @param res
* @param next
Expand Down
2 changes: 1 addition & 1 deletion admin/services/data-access/attendance-code.data.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const attendanceCodeDataService = {
* @returns {Promise<[{id: number, reason: string, code: string, order: number}] | undefined>}
*/
sqlFindAttendanceCodes: async () => {
const sql = `SELECT id, reason, code, [order] FROM ${sqlService.adminSchema}.[attendanceCode] WHERE isPrivileged = 0`
const sql = `SELECT id, reason, code, [order] FROM ${sqlService.adminSchema}.[attendanceCode] WHERE isPrivileged = 0 AND visible = 1`
return sqlService.readonlyQuery(sql)
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pupilAttendanceDataService.markAsNotAttending = async (slugs, code, userId, scho
-- Mark pupils as not attending
--
DECLARE @attendanceCode_id Int = (SELECT id from [mtc_admin].[attendanceCode] where code = @code AND isPrivileged = 0);
DECLARE @attendanceCode_id Int = (SELECT id from [mtc_admin].[attendanceCode] where code = @code AND isPrivileged = 0 AND visible = 1);
IF @attendanceCode_id IS NULL
THROW 51000, 'unknown attendanceCode.code', 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UPDATE mtc_admin.attendanceCode SET visible = 0 WHERE code = 'ABSNT'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UPDATE mtc_admin.attendanceCode SET visible = 1 WHERE code = 'ABSNT'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
IF NOT EXISTS(
SELECT *
FROM sys.columns
WHERE object_ID = object_id('mtc_admin.attendanceCode')
AND col_name(object_ID, column_Id) = 'visible')
BEGIN
ALTER TABLE [mtc_admin].[attendanceCode]
ADD [visible] bit NOT NULL CONSTRAINT DF_attendanceCode_visible_default DEFAULT 1;
END
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE [mtc_admin].[attendanceCode] DROP CONSTRAINT IF EXISTS [DF_attendanceCode_visible_default];
ALTER TABLE [mtc_admin].[attendanceCode] DROP COLUMN IF EXISTS [visible];
1 change: 0 additions & 1 deletion test/admin-hpa/features/pupil_audit.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Feature:
Examples:
| reason |
| Incorrect registration |
| Absent during check window |
| Left school |
| Unable to access |
| Working below expectation |
Expand Down
5 changes: 2 additions & 3 deletions test/admin-hpa/features/pupil_not_taking_check.feature
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Feature:
@pupil_not_taking_check
Scenario: Sticky banner displays pupil count
Given I am on the pupil reason page
When I select multiple pupils with the Absent during check window reason
When I select multiple pupils with the Incorrect registration reason
Then the sticky banner should display the pupil count

@pupil_not_taking_check
Expand Down Expand Up @@ -77,7 +77,6 @@ Feature:
Examples:
| reason |
| Incorrect registration |
| Absent during check window |
| Left school |
| Unable to access |
| Working below expectation |
Expand All @@ -86,7 +85,7 @@ Feature:
@pupil_not_taking_check
Scenario: Teachers can add multiple pupils
Given I am on the pupil reason page for multiple new pupil
When I add Absent during check window as a reason for multiple pupils
When I add Incorrect registration as a reason for multiple pupils
Then the reason should be stored against the pupils
And I should see the updated pupils on the hub page

Expand Down
3 changes: 1 addition & 2 deletions test/admin-hpa/features/pupil_status.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ Feature: Pupil Status Outcome
Then I can see the status for the pupil is <reason> for pupil not taking the check

Examples:
| reason |
| Absent during check window |
| reason |
| Incorrect registration |
| Left school |
| Working below expectation |
Expand Down
3 changes: 1 addition & 2 deletions test/admin-hpa/features/service_manager_pupil_search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ Feature:
Then the summary page is displayed with the attendance status set to <reason> along with details of the pupil

Examples:
| reason |
| Absent during check window |
| reason |
| Incorrect registration |
| Left school |
| Working below expectation |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
pupils_not_taking_check_page.add_reason.click
page.execute_script "window.scrollBy(0,500)"
@page = pupil_reason_page
pupil_reason_page.select_reason('Absent during check window')
pupil_reason_page.select_reason('Incorrect registration')
@pupil_row = pupil_reason_page.pupil_list.rows.select {|row| row.name.text.include?(name)}
@pupil_forename = @pupil_row.first.name.text.split(',')[1].strip
@pupil_lastname = @pupil_row.first.name.text.split(',')[0].strip
@pupil_row.first.checkbox.click
pupil_reason_page.sticky_banner.confirm.click

step 'the Absent during check window reason should be stored against the pupils'
step 'the Incorrect registration reason should be stored against the pupils'
pupil_status_page.load
Timeout.timeout(20) {pupil_status_page.not_taking_checks.count.click until pupil_status_page.not_taking_checks_details.pupil_list.visible? }
pupil_row = pupil_status_page.not_taking_checks_details.pupil_list.pupil_row.find { |r| r.text.include? @pupil_forename}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

Given(/^I have a pupil not taking the check$/) do
step 'I am on the pupil reason page for new pupil'
step 'I add Absent during check window as a reason for a particular pupil'
step 'the Absent during check window reason should be stored against the pupils'
step 'I add Incorrect registration as a reason for a particular pupil'
step 'the Incorrect registration reason should be stored against the pupils'
sleep 3
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@

Given(/^I have previously added a reason for a pupil$/) do
step 'I am on the pupil reason page for new pupil'
step 'I add Absent during check window as a reason for a particular pupil'
step 'the Absent during check window reason should be stored against the pupils'
step 'I add Incorrect registration as a reason for a particular pupil'
step 'the Incorrect registration reason should be stored against the pupils'
step 'I should see the updated pupil on the hub page'
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class PupilReasonPage < SitePrism::Page


def attendance_code_mapping
{'attendance-code-ABSNT' => 'Absent during check window',
'attendance-code-INCRG' => 'Incorrect registration',
{'attendance-code-INCRG' => 'Incorrect registration',
'attendance-code-LEFTT' => 'Left school',
'attendance-code-NOACC' => 'Unable to access',
'attendance-code-BLSTD' => 'Working below expectation',
Expand Down
2 changes: 1 addition & 1 deletion test/admin-hpa/features/support/sql_db_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def self.check_form_details(check_form_name)

def self.get_attendance_codes
@array_of_attCode = []
sql = "SELECT * FROM [mtc_admin].[attendanceCode]"
sql = "SELECT * FROM [mtc_admin].[attendanceCode] where visible=1"
result = SQL_CLIENT.execute(sql)
@array_of_attCode = result.each {|row| row.map}
result.cancel
Expand Down

0 comments on commit 9ebb24e

Please sign in to comment.