Created
March 1, 2013 19:34
-
-
Save jawsthegame/5067138 to your computer and use it in GitHub Desktop.
This file contains 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 PublisherContext { | |
def apply(device: Device, network: Network): PublisherContext = | |
apply(network) | |
def apply(ntwrk: Network): PublisherContext = apply(ntwrk, None, None) | |
def apply(ntwrk: Network, index: Option[Int], | |
ven: Option[Venue]): PublisherContext = { | |
val gvtData = ven.flatMap(_.gvtData).getOrElse(ntwrk.gvtData) | |
new PublisherContext { | |
val network = ntwrk | |
val cpmFloorCents = ven.flatMap(v => | |
if (v.cpmCents == Some(0)) None else v.cpmCents) | |
.getOrElse(ntwrk.cpmCents) | |
val impressionsPerSecond = gvtData.gvt.toDouble / gvtData.gvtSeconds | |
val dwellTimeSeconds = gvtData.dwellTime | |
val signageProviderId = ntwrk.signageProviderId | |
val geoindex = index | |
val venue = ven | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment