Skip to content

Commit

Permalink
Added Check for Assetgroups if DisplayDashboard flag is set
Browse files Browse the repository at this point in the history
  • Loading branch information
clackner-gpa committed Oct 14, 2020
1 parent 849a126 commit 4a0887c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/PQDashboard/Controllers/PQDashboardController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public GetMetersReturn GetMeters(MetersForm form)
using (AdoDataConnection connection = new AdoDataConnection("dbOpenXDA")) {
data.ParentAssetGroupID = connection.ExecuteScalar<int?>("SELECT TOP 1 ParentAssetGroupID FROM AssetGroupAssetGroup where ChildAssetGroupID = {0}", form.deviceFilter);
data.Meters = new TableOperations<Meter>(connection).QueryRecordsWhere("ID IN (SELECT MeterID FROM MeterAssetGroup WHERE AssetGroupID = {0})", form.deviceFilter);
var assetGroups = new TableOperations<AssetGroup>(connection).QueryRecordsWhere("ID IN (SELECT ChildAssetGroupID FROM AssetGroupAssetGroup WHERE ParentAssetGroupID = {0})", form.deviceFilter);
var assetGroups = new TableOperations<AssetGroup>(connection).QueryRecordsWhere("ID IN (SELECT ChildAssetGroupID FROM AssetGroupAssetGroup WHERE ParentAssetGroupID = {0}) AND DisplayDashboard = 1", form.deviceFilter);

data.AssetGroups = new List<AssetGroupWithSubIDs>();
foreach(var assetGroup in assetGroups)
Expand Down
2 changes: 1 addition & 1 deletion src/PQDashboard/Views/Main/Home.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

using(DataContext dataContext = new DataContext("dbOpenXDA")) {
historianConnection = dataContext.Table<Setting>().QueryRecordWhere("Name = 'Historian.URL'")?.Value ?? "127.0.0.0";
assetGroups = dataContext.Table<AssetGroup>().QueryRecords();
assetGroups = dataContext.Table<AssetGroup>().QueryRecordsWhere("DisplayDashboard = 1");
meterCount = dataContext.Connection.ExecuteScalar<int>("SELECT COUNT(*) FROM Meter WHERE ID IN (SELECT MeterID FROM MeterAssetGroup WHERE AssetGroupID IN (SELECT AssetGroupID FROM UserAccountAssetGroup WHERE UserAccountID = (SELECT ID FROM UserAccount WHERE Name = {0})))", ViewBag.usersid);
}

Expand Down

0 comments on commit 4a0887c

Please sign in to comment.