Revision 69 hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/StatisticsController.groovy
StatisticsController.groovy | ||
---|---|---|
101 | 101 |
|
102 | 102 |
def showGraph = { |
103 | 103 |
|
104 |
if(!params.outputDevice) params.outputDevice = 'none' |
|
105 |
|
|
104 | 106 |
def graphToShow = EneGraph.get(params['id']) |
105 | 107 |
String query |
106 | 108 |
|
107 | 109 |
List data = new ArrayList() |
108 | 110 |
data = graphDataService.getGraphData(graphToShow) |
109 | 111 |
|
110 |
[data: "{label: '" + graphToShow.name + "', data: " + data.toString() + " }"]
|
|
112 |
List outputDevices = new ArrayList()
|
|
111 | 113 |
|
114 |
def crit1 = DeviceInfo.createCriteria() |
|
115 |
outputDevices = crit1 { |
|
116 |
and { |
|
117 |
eq("outputDevice",true) |
|
118 |
eq("hwSet",session.hwSet) |
|
119 |
} |
|
120 |
order("friendlyName","asc") |
|
121 |
} |
|
122 |
|
|
123 |
// Fetch action logged data if needed |
|
124 |
List actionLog = new ArrayList() |
|
125 |
if(params.outputDevice != 'none') { |
|
126 |
def crit2 = LoggedData.createCriteria() |
|
127 |
actionLog = crit2 { |
|
128 |
and { |
|
129 |
eq("deviceId",params.outputDevice) |
|
130 |
between("dateRecieved",new java.util.Date(data[0][0]),new java.util.Date(data[-1][0])) |
|
131 |
} |
|
132 |
order("dateRecieved","asc") |
|
133 |
} |
|
134 |
} |
|
135 |
|
|
136 |
[data: "{label: '" + graphToShow.name + "', data: " + data.toString() + " }",outputDevices:outputDevices,actionLog:actionLog] |
|
137 |
|
|
112 | 138 |
} |
113 | 139 |
|
114 | 140 |
def editGraph = { |
Also available in: Unified diff