Skip to content

Commit

Permalink
fix(test): fixes broken patient record e2e
Browse files Browse the repository at this point in the history
This commit cleans up the documentation for services before submitting a
PR.  It finalizes the documentation for the PatientInvoice module,
making sure all services and methods have appropriate doc comments.
  • Loading branch information
jniles committed Jun 3, 2016
1 parent 5285c84 commit 32f6321
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 24 deletions.
12 changes: 7 additions & 5 deletions client/src/js/services/PatientInvoiceForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ PatientInvoiceFormService.$inject = [
* with the Patient PatientInvoiceForm module. You must specify a cacheKey to enable the
* class to be instantiated correctly.
*
* @todo (required) If all priceLists are percentages of the base price, we
* should be able to simply this logic.
* @todo (required) Discuss if all subsidies/billings services are percentages.
* @todo (required) Only the maximum of the bill should be subsidised
* @todo (required) discuss if all subsidies/billings services are all
* percentages. If so, the logic can be simplified.
* @todo (required) only the maximum of the bill should be subsidised
* @todo (required) billing services and subsidies should be ignored for
* specific debtors.
*
*/
function PatientInvoiceFormService(Patients, PriceLists, Inventory, AppCache, Store, Pool, PatientInvoiceItem) {

Expand Down Expand Up @@ -66,7 +68,7 @@ function PatientInvoiceFormService(Patients, PriceLists, Inventory, AppCache, St
* This function constructs a new instance of the PatientInvoiceForm class.
*
* @param {String} cacheKey - the AppCache key under which to store the
* invoice.
* invoice.
*/
function PatientInvoiceForm(cacheKey) {

Expand Down
12 changes: 8 additions & 4 deletions client/src/js/services/PatientInvoiceItemService.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ PatientInvoiceItemService.$inject = [ 'uuid' ];
* @class PatientInvoiceItemService
*
* @description
* This class implements the defaults for a patient invoice item. It implements
* a single method, `validate()`, to determine whether the item is valid or not.
* This class implements the defaults for a patient invoice item. The class is
* instantiated with every row of the Patient Invoice module's grid. It
* implements the following convenience methods:
* 1. validate() - sets the `_valid` and `_invalid` flags on the row
* 2. configure() - sets up the row's inventory item reference
* 3. applyPriceList() - apply's the price list to the row
*/
function PatientInvoiceItemService(uuid) {

Expand All @@ -21,7 +25,7 @@ function PatientInvoiceItemService(uuid) {
* set later.
*
* @param {Object} inventoryItem - an inventory item to use as the inventory
* line.
* line.
*/
function PatientInvoiceItem(inventoryItem) {

Expand Down Expand Up @@ -84,6 +88,7 @@ function PatientInvoiceItemService(uuid) {
this.inventory_price = inventoryItem.price;
this.inventory_uuid = inventoryItem.uuid;

// rest eh validation flags.
this.validate();
};

Expand Down Expand Up @@ -114,6 +119,5 @@ function PatientInvoiceItemService(uuid) {
this.validate();
};


return PatientInvoiceItem;
}
29 changes: 15 additions & 14 deletions client/src/partials/patient_invoice/patientInvoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ PatientInvoiceController.$inject = [
];

/**
* Patient Invoice Controller
* @module PatientInvoiceController
*
* @description
* This module binds the Patient Invoice Form service to the view.
*
* @todo (required) Tabbing through UI grid. Code -> Quantity -> Price
* @todo (required) Design and implement how cautions are assigned. Client vs. Server
* @todo (required) Sale made outside of fiscal year error should be handled and shown to user
* @todo (required) Billing services and subsidies should be ignored for specific debtors
* @todo Total rows formatted to show subsidy as subtraction and make clear running total
*
* @module PatientInvoiceController
* @todo (requires) use a loading button for the form loading state.
*/
function PatientInvoiceController(Patients, PatientInvoices, PatientInvoiceForm, util, Services, Session, Dates, Receipts, Notify) {
var vm = this;
Expand All @@ -29,6 +28,15 @@ function PatientInvoiceController(Patients, PatientInvoices, PatientInvoiceForm,
vm.minimumDate = util.minimumDate;
vm.itemIncrement = 1;

// read in services and bind to the view
Services.read()
.then(function (services) {
vm.services = services;

// default to the first service
vm.Invoice.setService(services[0]);
});

var gridOptions = {
appScopeProvider : vm,
enableSorting : false,
Expand All @@ -46,6 +54,7 @@ function PatientInvoiceController(Patients, PatientInvoices, PatientInvoiceForm,
data : vm.Invoice.store.data
};


// called when the grid is initialized
function exposeGridScroll(gridApi) {
vm.gridApi = gridApi;
Expand Down Expand Up @@ -160,14 +169,6 @@ function PatientInvoiceController(Patients, PatientInvoices, PatientInvoiceForm,
vm.addItems = addItems;
vm.handleChange = handleChange;

// read in services and bind to the view
Services.read()
.then(function (services) {
vm.services = services;

// default to the first service
vm.Invoice.setService(services[0]);
});

// Set initial default values
clear();
Expand Down
1 change: 0 additions & 1 deletion client/test/e2e/patient/record.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@ describe('Patient Record', function () {
components.notification.hasError();
expect(element(by.id('nopatient')).isPresent()).to.eventually.equal(true);
});

});

0 comments on commit 32f6321

Please sign in to comment.