mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
More features
This commit is contained in:
@ -32,7 +32,6 @@ exports.get = function(req, res, next) {
|
|||||||
|
|
||||||
Device.findById(id)
|
Device.findById(id)
|
||||||
.populate('deviceType', 'category make model checkList')
|
.populate('deviceType', 'category make model checkList')
|
||||||
.populate('deviceType.checkList', 'name fields')
|
|
||||||
.populate('client', 'name identifier')
|
.populate('client', 'name identifier')
|
||||||
.exec(returnResult(res));
|
.exec(returnResult(res));
|
||||||
};
|
};
|
||||||
|
@ -115,6 +115,15 @@ module.exports = function(config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testRun.save(returnResult(res));
|
testRun.save(returnResult(res));
|
||||||
|
|
||||||
|
Device.findById(testRun.device, function(err, device) {
|
||||||
|
if (err) {
|
||||||
|
log.error("Failed to fetch device for testRun: %s", err);
|
||||||
|
} else {
|
||||||
|
device.lastTestRun = testRun;
|
||||||
|
device.save();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function(req, res, next) {
|
update: function(req, res, next) {
|
||||||
|
@ -108,12 +108,12 @@ module.exports = function(config, calendar) {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(callback) {
|
function(callback) {
|
||||||
Device.find({client: req.body.client, deleted: false })
|
Device.find({'_id': { $in: req.body.devices }})
|
||||||
.populate({path: 'deviceType'})
|
.populate({path: 'deviceType'})
|
||||||
.exec(function(err, results) {
|
.exec(function(err, results) {
|
||||||
devices = results;
|
devices = results;
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(callback) {
|
function(callback) {
|
||||||
User.find({
|
User.find({
|
||||||
|
@ -13,6 +13,7 @@ var deviceSchema = new Schema({
|
|||||||
location: String,
|
location: String,
|
||||||
frequencyType: String,
|
frequencyType: String,
|
||||||
frequencySchedule: [],
|
frequencySchedule: [],
|
||||||
|
lastTestRun: {},
|
||||||
deleted: { type: Boolean, default: false }
|
deleted: { type: Boolean, default: false }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ function testRunAddController($scope, Devices, CheckLists, TestRuns, $location,
|
|||||||
field.result = (field.value == 'true');
|
field.result = (field.value == 'true');
|
||||||
} else if (field.type == 'range') {
|
} else if (field.type == 'range') {
|
||||||
field.result = field.value >= field.min && field.value <= field.max;
|
field.result = field.value >= field.min && field.value <= field.max;
|
||||||
|
} else if (field.type == 'text') {
|
||||||
|
field.result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.model.result &= field.result;
|
$scope.model.result &= field.result;
|
||||||
@ -55,4 +57,4 @@ function testRunAddController($scope, Devices, CheckLists, TestRuns, $location,
|
|||||||
|
|
||||||
function testRunViewController($scope, Devices, CheckLists, TestRuns, $location, $filter, $routeParams) {
|
function testRunViewController($scope, Devices, CheckLists, TestRuns, $location, $filter, $routeParams) {
|
||||||
$scope.model = TestRuns.get($routeParams);
|
$scope.model = TestRuns.get($routeParams);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
<select ng-model="field.type" class="input-xlarge" required>
|
<select ng-model="field.type" class="input-xlarge" required>
|
||||||
<option value="boolean">Pass / Fail</option>
|
<option value="boolean">Pass / Fail</option>
|
||||||
<option value="range">Range</option>
|
<option value="range">Range</option>
|
||||||
|
<option value="text">Text</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -305,7 +305,8 @@
|
|||||||
<th style="width: 5%">Serial No.</th>
|
<th style="width: 5%">Serial No.</th>
|
||||||
<th style="width: 8%">Purchase Date</th>
|
<th style="width: 8%">Purchase Date</th>
|
||||||
<th style="width: 6%">Warranty Expiration</th>
|
<th style="width: 6%">Warranty Expiration</th>
|
||||||
<th style="width: 8%">PM Test</th>
|
<th style="width: 4%">PM Test</th>
|
||||||
|
<th style="width: 8%">Last Test Run</th>
|
||||||
<th style="width: 4%">Location</th>
|
<th style="width: 4%">Location</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -319,7 +320,16 @@
|
|||||||
<td>{{device.serialNumber}}</td>
|
<td>{{device.serialNumber}}</td>
|
||||||
<td>{{device.purchaseDate | date}}</td>
|
<td>{{device.purchaseDate | date}}</td>
|
||||||
<td>{{device.warrantyExpiration | date}}</td>
|
<td>{{device.warrantyExpiration | date}}</td>
|
||||||
<td></td>
|
<td><a href="/testRuns/add?deviceId{{device._id}}">New</a></td>
|
||||||
|
<td>
|
||||||
|
<div ng-if="device.lastTestRun">
|
||||||
|
<a href="http://localhost:9000/testRuns/{{device.lastTestRun._id}}">
|
||||||
|
<span>{{device.lastTestRun.date | date}} | </span>
|
||||||
|
<span ng-if="device.lastTestRun.result">Passed</span>
|
||||||
|
<span ng-if="!device.lastTestRun.result">Failed</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
<td>{{device.location}}</td>
|
<td>{{device.location}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -32,6 +32,12 @@
|
|||||||
<input ng-model="field.value" type="number" class="input-xlarge" required>
|
<input ng-model="field.value" type="number" class="input-xlarge" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="control-group" ng-if="field.type == 'text'">
|
||||||
|
<label class="control-label">Result</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input ng-model="field.value" type="text" class="input-xlarge" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">Comments</label>
|
<label class="control-label">Comments</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
Reference in New Issue
Block a user