Added information to the chromebook data.
This commit is contained in:
@@ -43,6 +43,16 @@ if (Meteor.isServer) {
|
||||
if(Roles.userIsInRole(Meteor.userId(), "laptop-management", {anyScope:true})) {
|
||||
let query = {};
|
||||
|
||||
// For asset ID's, we need to get the serial from the asset collection first.
|
||||
if(params.assetId) {
|
||||
let asset = Assets.findOne({assetId : params.assetId});
|
||||
|
||||
if(asset) {
|
||||
params.serial = asset.serial;
|
||||
params.regex = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (params.deviceId) query.deviceId = params.regex ? {
|
||||
$regex: params.deviceId,
|
||||
$options: "i"
|
||||
@@ -51,14 +61,14 @@ if (Meteor.isServer) {
|
||||
$regex: params.serial,
|
||||
$options: "i"
|
||||
} : params.serial;
|
||||
else if (params.assetId) {
|
||||
let asset = Assets.findOne({assetId: params.assetId});
|
||||
|
||||
if(asset.serial) {
|
||||
// An exact search.
|
||||
query.serial = asset.serial;
|
||||
}
|
||||
}
|
||||
// else if (params.assetId) {
|
||||
// let asset = Assets.findOne({assetId: params.assetId});
|
||||
//
|
||||
// if(asset.serial) {
|
||||
// // An exact search.
|
||||
// query.serial = asset.serial;
|
||||
// }
|
||||
// }
|
||||
else if (params.email) query.email = params.regex ? {
|
||||
$regex: params.email,
|
||||
$options: "i"
|
||||
@@ -66,18 +76,23 @@ if (Meteor.isServer) {
|
||||
else if (params.date) { //Assume that date is a number. Finds all Chromebook Data with the last check in time greater than or equal to the given date.
|
||||
query.endTime = {'$gte': params.date}
|
||||
}
|
||||
else {
|
||||
query = undefined;
|
||||
}
|
||||
|
||||
console.log("Collecting Chromebook Data: ");
|
||||
console.log(query);
|
||||
if(query) {
|
||||
console.log("Collecting Chromebook Data: ");
|
||||
console.log(query);
|
||||
|
||||
//Sort by the last time the record was updated from most to least recent.
|
||||
let result = Meteor.Records.find(query, {sort: {endTime: -1}}).fetch();
|
||||
// console.log("Found: ");
|
||||
// console.log(result);
|
||||
//Sort by the last time the record was updated from most to least recent.
|
||||
let result = Meteor.Records.find(query, {sort: {endTime: -1}}).fetch();
|
||||
// console.log("Found: ");
|
||||
// console.log(result);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
} else return null;
|
||||
}
|
||||
else {return null;}
|
||||
else return null;
|
||||
}
|
||||
// 'tasks.setChecked'(taskId, setChecked) {
|
||||
// check(taskId, String);
|
||||
|
||||
Reference in New Issue
Block a user