Skip to content

Commit

Permalink
[Cleanup] eslint one-var
Browse files Browse the repository at this point in the history
`let a = 1, b = 2;` -> `let a = 1; let b = 2;`

Part of HospitalRun#732.

Merging HospitalRun#736.  Closes HospitalRun#736.
  • Loading branch information
btecu authored and jkleinsc committed Oct 13, 2016
1 parent 13a9a64 commit fafd430
Show file tree
Hide file tree
Showing 101 changed files with 920 additions and 933 deletions.
12 changes: 6 additions & 6 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export default Adapter.extend(PouchAdapterUtils, {
return database.getEmberId(row.id);
});
this.findRecord(store, type, ids).then((findResponse) => {
let primaryRecordName = type.modelName.camelize().pluralize(),
sortedValues = [];
let primaryRecordName = type.modelName.camelize().pluralize();
let sortedValues = [];
// Sort response in order of ids
ids.forEach((id) => {
let resolvedRecord = findResponse[primaryRecordName].findBy('id', id);
Expand All @@ -101,8 +101,8 @@ export default Adapter.extend(PouchAdapterUtils, {
* Look for nulls and maxvalues in start key because those keys can't be handled by the sort/list function
*/
_doesStartKeyContainSpecialCharacters(startkey) {
let haveSpecialCharacters = false,
maxValue = this.get('maxValue');
let haveSpecialCharacters = false;
let maxValue = this.get('maxValue');
if (!Ember.isEmpty(startkey) && Ember.isArray(startkey)) {
startkey.forEach((keyvalue) => {
if (keyvalue === null || keyvalue === maxValue) {
Expand Down Expand Up @@ -147,8 +147,8 @@ export default Adapter.extend(PouchAdapterUtils, {
return this._super(store, type, query, options);
}
} else {
let mapReduce = null,
queryParams = {};
let mapReduce = null;
let queryParams = {};
if (query.options) {
queryParams = Ember.copy(query.options);
if (query.sortKey || query.filterBy) {
Expand Down
4 changes: 2 additions & 2 deletions app/admin/loaddb/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export default Ember.Controller.extend(ModalHelper, ProgressDialog, {

actions: {
loadFile: function() {
let fileSystem = this.get('fileSystem'),
fileToImport = this.get('importFile');
let fileSystem = this.get('fileSystem');
let fileToImport = this.get('importFile');
if (!fileToImport || !fileToImport.type) {
this.displayAlert(
this.get('i18n').t('admin.loaddb.displayAlertTitle'),
Expand Down
38 changes: 19 additions & 19 deletions app/admin/lookup/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
importFile: Ember.computed.alias('lookupTypeList.importFile'),

lookupTitle: function() {
let lookupType = this.get('model.lookupType'),
lookupTypes = this.get('lookupTypes'),
lookupDesc;
let lookupType = this.get('model.lookupType');
let lookupTypes = this.get('lookupTypes');
let lookupDesc;
if (!Ember.isEmpty(lookupType)) {
lookupDesc = lookupTypes.findBy('value', lookupType);
if (!Ember.isEmpty(lookupDesc)) {
Expand All @@ -206,15 +206,15 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
}.property('model.lookupType'),

lookupTypeList: function() {
let lookupType = this.get('model.lookupType'),
lookupItem;
let lookupType = this.get('model.lookupType');
let lookupItem;
if (!Ember.isEmpty(lookupType)) {
lookupItem = this.get('model').findBy('id', lookupType);
if (Ember.isEmpty(lookupItem) || !lookupItem.get('isLoaded')) {
let defaultValues = [],
lookupTypes = this.get('lookupTypes'),
lookupDesc = lookupTypes.findBy('value', lookupType),
store = this.get('store');
let defaultValues = [];
let lookupTypes = this.get('lookupTypes');
let lookupDesc = lookupTypes.findBy('value', lookupType);
let store = this.get('store');
if (!Ember.isEmpty(lookupDesc) && !Ember.isEmpty(lookupDesc.defaultValues)) {
defaultValues = this.get(lookupDesc.defaultValues);
}
Expand Down Expand Up @@ -329,8 +329,8 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
}));
},
deleteValue: function(value) {
let lookupTypeList = this.get('lookupTypeList'),
lookupTypeValues = lookupTypeList.get('value');
let lookupTypeList = this.get('lookupTypeList');
let lookupTypeValues = lookupTypeList.get('value');
if (this._canDeleteValue(value)) {
lookupTypeValues.removeObject(value.toString());
lookupTypeList.save();
Expand All @@ -346,9 +346,9 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
}
},
importList: function() {
let fileSystem = this.get('fileSystem'),
fileToImport = this.get('importFile'),
lookupTypeList = this.get('lookupTypeList');
let fileSystem = this.get('fileSystem');
let fileToImport = this.get('importFile');
let lookupTypeList = this.get('lookupTypeList');
if (!fileToImport || !fileToImport.type) {
this.displayAlert(
this.get('i18n').t('admin.lookup.alertImportListTitle'),
Expand Down Expand Up @@ -389,11 +389,11 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
}.bind(this));
},
updateValue: function(valueObject) {
let updateList = false,
lookupTypeList = this.get('lookupTypeList'),
lookupTypeValues = this.get('lookupTypeValues'),
values = lookupTypeList.get('value'),
value = valueObject.get('value');
let updateList = false;
let lookupTypeList = this.get('lookupTypeList');
let lookupTypeValues = this.get('lookupTypeValues');
let values = lookupTypeList.get('value');
let value = valueObject.get('value');
if (valueObject.get('isNew')) {
updateList = true;
} else {
Expand Down
15 changes: 7 additions & 8 deletions app/admin/query/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export default Ember.Controller.extend(EditPanelProps, {

actions: {
query: function() {
let fieldName = this.get('fieldName'),
objectType = this.get('objectType'),
queryValue = this.get('queryValue');
let fieldName = this.get('fieldName');
let objectType = this.get('objectType');
let queryValue = this.get('queryValue');
let query = {
containsValue: {
value: queryValue,
Expand All @@ -43,16 +43,15 @@ export default Ember.Controller.extend(EditPanelProps, {
this.set('haveError', true);
this.set('showQueryResults', false);
} else {
let currentValue,
attributes = ['id'],
resultRow,
resultRows = [];
let currentValue;
let attributes = ['id'];
let resultRows = [];
results.get('firstObject').eachAttribute(function(name) {
attributes.push(name);
});

results.forEach(function(result) {
resultRow = [];
let resultRow = [];
/*resultRow.push({
name: 'id',
value: result.get('id')
Expand Down
38 changes: 19 additions & 19 deletions app/appointments/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu
startMinute: null,

hourList: function() {
let hour,
hourList = [];
let hour;
let hourList = [];
for (hour = 0; hour < 24; hour++) {
let hourText = (hour % 12) + (hour < 12 ? ' AM' : ' PM');
if (hourText === '0 AM') {
Expand Down Expand Up @@ -43,8 +43,8 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu
}],

minuteList: function() {
let minute,
minuteList = [];
let minute;
let minuteList = [];
for (minute = 0; minute < 60; minute++) {
minuteList.push(String('00' + minute).slice(-2));
}
Expand All @@ -53,8 +53,8 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu

physicianList: Ember.computed.alias('appointmentsController.physicianList'),
showTime: function() {
let allDay = this.get('model.allDay'),
isAdmissionAppointment = this.get('isAdmissionAppointment');
let allDay = this.get('model.allDay');
let isAdmissionAppointment = this.get('isAdmissionAppointment');
return (!allDay && isAdmissionAppointment);
}.property('model.allDay', 'isAdmissionAppointment'),
visitTypesList: Ember.computed.alias('appointmentsController.visitTypesList'),
Expand All @@ -69,9 +69,9 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu
}.property('model.returnTo'),

isAdmissionAppointment: function() {
let model = this.get('model'),
appointmentType = model.get('appointmentType'),
isAdmissionAppointment = (appointmentType === 'Admission');
let model = this.get('model');
let appointmentType = model.get('appointmentType');
let isAdmissionAppointment = (appointmentType === 'Admission');
if (!isAdmissionAppointment) {
model.set('allDay', true);
}
Expand Down Expand Up @@ -103,11 +103,11 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu
}.property('model.isValid'),

isAllDay: function() {
let allDay = this.get('model.allDay'),
isAdmissionAppointment = this.get('isAdmissionAppointment');
let allDay = this.get('model.allDay');
let isAdmissionAppointment = this.get('isAdmissionAppointment');
if (allDay) {
let endDate = this.get('model.endDate'),
startDate = this.get('model.startDate');
let endDate = this.get('model.endDate');
let startDate = this.get('model.startDate');
this.set('model.startDate', moment(startDate).startOf('day').toDate());
this.set('startHour', 0);
this.set('startMinute', '00');
Expand Down Expand Up @@ -138,9 +138,9 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu
},

_updateAppointmentDates: function() {
let allDay = this.get('model.allDay'),
isAdmissionAppointment = this.get('isAdmissionAppointment'),
appointmentDate = this.get('model.appointmentDate');
let allDay = this.get('model.allDay');
let isAdmissionAppointment = this.get('isAdmissionAppointment');
let appointmentDate = this.get('model.appointmentDate');
if (!isAdmissionAppointment) {
this.set('model.endDate', appointmentDate);
this.set('model.startDate', appointmentDate);
Expand All @@ -151,9 +151,9 @@ export default AbstractEditController.extend(AppointmentStatuses, PatientSubmodu
},

_updateDate: function(fieldName, dateFieldName) {
let model = this.get('model'),
fieldValue = this.get(fieldName),
dateToChange = model.get(dateFieldName);
let model = this.get('model');
let fieldValue = this.get(fieldName);
let dateToChange = model.get(dateFieldName);
if (!Ember.isEmpty(dateToChange)) {
dateToChange = moment(dateToChange);
if (fieldName.indexOf('Hour') > -1) {
Expand Down
12 changes: 6 additions & 6 deletions app/appointments/index/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export default AbstractIndexRoute.extend({
pageTitle: t('appointments.thisWeek'),

_getStartKeyFromItem: function(item) {
let endDate = item.get('endDate'),
id = this._getPouchIdFromItem(item),
startDate = item.get('startDate');
let endDate = item.get('endDate');
let id = this._getPouchIdFromItem(item);
let startDate = item.get('startDate');
if (endDate && endDate !== '') {
endDate = new Date(endDate);
if (endDate.getTime) {
Expand All @@ -27,9 +27,9 @@ export default AbstractIndexRoute.extend({
},

_modelQueryParams: function() {
let endOfWeek = moment().endOf('week').toDate().getTime(),
startOfWeek = moment().startOf('week').toDate().getTime(),
maxId = this._getMaxPouchId();
let endOfWeek = moment().endOf('week').toDate().getTime();
let startOfWeek = moment().startOf('week').toDate().getTime();
let maxId = this._getMaxPouchId();
return {
options: {
startkey: [startOfWeek, null, null],
Expand Down
12 changes: 6 additions & 6 deletions app/appointments/search/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes

actions: {
search: function() {
let appointmentType = this.get('model.selectedAppointmentType'),
fieldsToSet = {
let appointmentType = this.get('model.selectedAppointmentType');
let fieldsToSet = {
startKey: [],
previousStartKey: null,
previousStartKeys: []
},
provider = this.get('model.selectedProvider'),
status = this.get('model.selectedStatus'),
startDate = this.get('model.selectedStartingDate');
};
let provider = this.get('model.selectedProvider');
let status = this.get('model.selectedStatus');
let startDate = this.get('model.selectedStartingDate');

if (Ember.isEmpty(appointmentType)) {
fieldsToSet.appointmentType = null;
Expand Down
4 changes: 2 additions & 2 deletions app/appointments/search/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default AppointmentIndexRoute.extend(DateFormat, {
},

_modelQueryParams: function(params) {
let startDate = params.startDate,
maxValue = this.get('maxValue');
let startDate = params.startDate;
let maxValue = this.get('maxValue');
if (Ember.isEmpty(startDate)) {
startDate = moment();
} else {
Expand Down
6 changes: 3 additions & 3 deletions app/appointments/today/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export default AppointmentIndexRoute.extend({
pageTitle: t('appointments.todayTitle'),

_modelQueryParams: function() {
let endOfDay = moment().endOf('day').toDate().getTime(),
maxValue = this.get('maxValue'),
startOfDay = moment().startOf('day').toDate().getTime();
let endOfDay = moment().endOf('day').toDate().getTime();
let maxValue = this.get('maxValue');
let startOfDay = moment().startOf('day').toDate().getTime();
return {
options: {
startkey: [startOfDay, null, 'appointment_'],
Expand Down
18 changes: 9 additions & 9 deletions app/components/checkbox-or-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ export default SelectOrTypeahead.extend({
_setup: function() {
let property = this.get('property');
Ember.defineProperty(this, 'errors', Ember.computed('model.errors.' + property, function() {
let property = this.get('property'),
errors = this.get('model.errors.' + property);
let property = this.get('property');
let errors = this.get('model.errors.' + property);
if (!Ember.isEmpty(errors)) {
return errors[0];
}
}));
}.on('init'),

checkboxRows: function() {
let checkboxRows = [],
checkboxesPerRow = this.get('checkboxesPerRow'),
content = this.get('content'),
allValues = content.copy();
let checkboxRows = [];
let checkboxesPerRow = this.get('checkboxesPerRow');
let content = this.get('content');
let allValues = content.copy();
while (allValues.length > 0) {
let checkBoxRowValues = allValues.splice(0, checkboxesPerRow).map(this._mapCheckboxValues.bind(this));
checkboxRows.push(checkBoxRowValues);
Expand All @@ -46,9 +46,9 @@ export default SelectOrTypeahead.extend({

actions: {
checkboxChanged: function(value, checked) {
let property = this.get('property'),
propertyName = 'model.' + property,
selectedValues = this.get(propertyName);
let property = this.get('property');
let propertyName = 'model.' + property;
let selectedValues = this.get(propertyName);
if (!Ember.isArray(selectedValues)) {
selectedValues = [];
}
Expand Down
20 changes: 10 additions & 10 deletions app/components/date-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default HtmlInput.extend({
},

currentDateChangedValue: function() {
let currentDate = this.get('currentDate'),
picker = this.get('_picker');
let currentDate = this.get('currentDate');
let picker = this.get('_picker');
if (!Ember.isEmpty(currentDate) && this._shouldSetDate(currentDate, picker)) {
picker.setDate(currentDate);
}
Expand All @@ -35,18 +35,18 @@ export default HtmlInput.extend({
}.observes('mainComponent.showTime'),

dateSet: function() {
let currentDate = this.get('currentDate'),
picker = this.get('_picker');
let currentDate = this.get('currentDate');
let picker = this.get('_picker');
if (this._shouldSetDate(currentDate, picker)) {
this.set('currentDate', picker.getDate());
}
},

didInsertElement: function() {
let currentDate = this.get('currentDate'),
$input = this.$('input'),
picker = null,
props = this.getProperties('format', 'yearRange', 'showTime');
let currentDate = this.get('currentDate');
let $input = this.$('input');
let picker = null;
let props = this.getProperties('format', 'yearRange', 'showTime');

props.onSelect = this.dateSet.bind(this);

Expand All @@ -72,8 +72,8 @@ export default HtmlInput.extend({

didReceiveAttrs(/*attrs*/) {
this._super(...arguments);
let dateProperty = this.get('mainComponent.property'),
displayPropertyName = 'display_' + dateProperty;
let dateProperty = this.get('mainComponent.property');
let displayPropertyName = 'display_' + dateProperty;
this.set('mainComponent.property', displayPropertyName);
this.currentDate = Ember.computed.alias('mainComponent.model.' + dateProperty);
this.selectedValue = Ember.computed.alias('mainComponent.model.' + displayPropertyName);
Expand Down
Loading

0 comments on commit fafd430

Please sign in to comment.