This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val sensorDatas = TableQuery[SensorDataTable] | |
val sensorRoomLinks = TableQuery[SensorRoomLinks] | |
private def sensorsForRoomsForRange(roomLinks: Seq[SensorRoomLink], from: ZonedDateTime, to: ZonedDateTime): Query[(tables.SensorRoomLinks, tables.SensorDataTable), (SensorRoomLink, UtilizationData), Seq] = { | |
import IdTable._ | |
val joined = sensorDatas join sensorRoomLinks on (_.sensorId === _.sensorUid) | |
val filtered = joined.filter { case (data, link) => (link.roomId inSet roomLinks) && (data.sensorUid inSet sensorIds) && /* other conditions here */ } | |
val grouped = filtered.groupBy { case (data, link) => link.roomId } | |
val aggregated = grouped.map { case (roomId, rows) => roomId -> rows.map{ case (data, link) => data.value }.max } | |
aggregated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main { | |
def main(args: Array[String]) { | |
MySquerylScheme.initialize() | |
WebServer("src/main/webapp", Config.webServerPort) { server => | |
server.inContext("/api") { context => | |
context.mount("validate", new ValidateApp) | |
context.mount("channels", new MessageChannelApp) | |
context.mount("streams", new StreamsApp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main { | |
def main(args: Array[String]) { | |
MySquerylScheme.initialize() | |
WebServer("src/main/webapp", Config.webServerPort) { server => | |
server.inContext("/api") { context => | |
context.mount("validate", new ValidateApp) | |
context.mount("channels", new MessageChannelApp) | |
context.mount("streams", new StreamsApp) |