Skip to content

Commit

Permalink
fix(patients): make sure registry columns load
Browse files Browse the repository at this point in the history
This commit makes sure that the patient registry loads all the columns
in the registry, including last_visit, and others.
  • Loading branch information
Jonathan Niles authored and sfount committed Dec 27, 2016
1 parent cba41ea commit 9f5a105
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/src/partials/patients/registry/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function PatientRegistryController($state, Patients, Notify, AppCache, util, Rec
{ field : 'reference',
displayName : 'TABLE.COLUMNS.REFERENCE',
aggregationType: uiGridConstants.aggregationTypes.count,
aggregationHideLabel : true
aggregationHideLabel : true, headerCellFilter: 'translate'
},
{ field : 'display_name', displayName : 'TABLE.COLUMNS.NAME', headerCellFilter: 'translate' },
{ field : 'patientAge', displayName : 'TABLE.COLUMNS.AGE', headerCellFilter: 'translate' },
Expand Down
8 changes: 4 additions & 4 deletions server/controllers/medical/patients/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ function find(options) {
, q.abbr, q.father_name, q.mother_name, q.profession, q.employer, q.hospital_no,
q.spouse, q.spouse_profession, q.spouse_employer, q.religion, q.marital_status,
q.phone, q.email, q.address_1, q.address_2, q.renewal, BUID(q.origin_location_id) as origin_location_id,
BUID(q.current_location_id) as current_location_id, q.registration_date, q.title, q.notes, q.hospital_no,
q.text, q.account_id, BUID(q.price_list_uuid) as price_list_uuid, q.is_convention, q.locked, q.last_visit
BUID(q.current_location_id) as current_location_id, q.registration_date, q.title, q.notes, q.text,
q.account_id, BUID(q.price_list_uuid) as price_list_uuid, q.is_convention, q.locked
`;

// remove options.detailed so that it cannot be used again
Expand All @@ -389,7 +389,7 @@ function find(options) {
// build the main part of the SQL query
let sql = `
SELECT BUID(q.uuid) AS uuid, q.project_id, q.reference, q.display_name, BUID(q.debtor_uuid) as debtor_uuid,
q.sex, q.dob, q.registration_date, q.debtor_group_uuid ${detailedColumns}
q.sex, q.dob, q.registration_date, q.debtor_group_uuid, q.hospital_no, q.last_visit ${detailedColumns}
FROM (
SELECT p.uuid, p.project_id, CONCAT_WS('.', '${identifiers.PATIENT}', proj.abbr, p.reference) AS reference,
p.display_name, p.debtor_uuid AS debtor_uuid, p.sex, p.dob, p.father_name, p.mother_name, p.profession,
Expand All @@ -411,7 +411,7 @@ function find(options) {
if (options.name) {
let keyValue = '%' + options.name + '%';

conditions.statements.push('q.display_name LIKE ? ');
conditions.statements.push('LOWER(q.display_name) LIKE ? ');
conditions.parameters.push(keyValue);

// remove options.name so that it cannot be used again
Expand Down
4 changes: 3 additions & 1 deletion test/end-to-end/locations/countries.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global element, by, browser */

const chai = require('chai');
const expect = chai.expect;

Expand Down Expand Up @@ -41,8 +42,9 @@ describe('Countries Management', function () {
});

it('blocks invalid form submission with relevant error classes', function () {

// switch to the create form
element(by.id('create')).click();
FU.buttons.create();

// verify form has not been successfully submitted
expect(helpers.getCurrentPath()).to.eventually.equal(path);
Expand Down
5 changes: 4 additions & 1 deletion test/end-to-end/locations/provinces.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Provinces Management', function () {
};

it('creates a new province', function () {

// switch to the create form
FU.buttons.create();

Expand All @@ -45,7 +46,9 @@ describe('Provinces Management', function () {
});

it('blocks invalid form submission with relevant error classes', function () {
element(by.id('create')).click();

// switch to the create form
FU.buttons.create();

// verify form has not been successfully submitted
expect(helpers.getCurrentPath()).to.eventually.equal(path);
Expand Down
3 changes: 2 additions & 1 deletion test/end-to-end/locations/sectors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ describe('Sectors Management', function () {
});

it('blocks invalid form submission with relevant error classes', function () {

// switch to the create form
element(by.id('create')).click();
FU.buttons.create();

// Verify form has not been successfully submitted
expect(helpers.getCurrentPath()).to.eventually.equal('#/locations/sector');
Expand Down
4 changes: 3 additions & 1 deletion test/end-to-end/locations/villages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('Villages Management', function () {
};

it('creates a new village', function () {

// switch to the create form
FU.buttons.create();

Expand Down Expand Up @@ -53,8 +54,9 @@ describe('Villages Management', function () {
});

it('correctly blocks invalid form submission with relevant error classes', function () {

// switch to the create form
element(by.id('create')).click();
FU.buttons.create();

// verify form has not been submitted
expect(helpers.getCurrentPath()).to.eventually.equal(path);
Expand Down

0 comments on commit 9f5a105

Please sign in to comment.