Conversation
| val product = nextEntry._1 | ||
| val tsNs = nextEntry._2 | ||
|
|
||
|
|
| plan | ||
| } | ||
|
|
||
| def readTrendsFromFile(startTs: DateTime) : PriorityMap[Product, Long] = { |
There was a problem hiding this comment.
This function should be removed, it exists in Products.scala
| import scala.util.Random | ||
|
|
||
| object Trends extends ApplicationConfig with LazyLogging { | ||
| private def parseTrendFromFile(filename: String) : Product = { |
There was a problem hiding this comment.
This function should be removed, it exists in Products.scala
src/main/resources/application.conf
Outdated
|
|
||
| # Scale up or scale down the amount of cdrs generated (1 for realistic values) | ||
| modifier=0.01 | ||
| modifier=0.001 |
src/main/resources/application.conf
Outdated
|
|
||
| # Total amount of hours to generate back in time | ||
| backintime=48 | ||
| backintime=96 |
| these ++ f.listFiles.filter(_.isDirectory).flatMap(recursiveListFiles) | ||
| } | ||
|
|
||
| val trendsDirPath = Option(System.getProperty("trends.dir")) match { |
There was a problem hiding this comment.
This is using the old version of trendsDirPath, the one in master is now:
val trendsDirPath = Option(System.getProperty("trends.dir")).
getOrElse(getClass.getClassLoader.getResource("trends").getPath)
There was a problem hiding this comment.
github did not fix the indentation for that code above.
| val files = recursiveListFiles(new File(trendsDirPath)) | ||
|
|
||
| // Create a priority list out of all products with default timestamp | ||
| var pmap = mutable.HashMap.empty[Product, Long] |
There was a problem hiding this comment.
pmap can be removed as it is not used anymore.
| newDay = timeCheck + 1 | ||
| if (newDay == 8) {newDay = (newDay % 7)} | ||
| products = Trends.changeTrends(products) | ||
| } |
There was a problem hiding this comment.
I don't think these variables are descriptive.
newDay, timeCheck?
There was a problem hiding this comment.
Also please write some quick comment that describes what this chunk of code does.
| newDay = timeCheck + 1 | ||
| if (newDay == 8) {newDay = (newDay % 7)} | ||
| products = Trends.changeTrends(products) | ||
| } |
There was a problem hiding this comment.
Also please write some quick comment that describes what this chunk of code does.
|
|
||
| def changeTrends(maptemp: PriorityMap[Product, Long]) : PriorityMap[Product, Long] = { | ||
| val e = maptemp.map(p => (p._1.copy(points = p._1.points.map(point => point.copy( | ||
| cdrPerSec = (((Random.nextFloat()*0.2) + (-0.1))*point.cdrPerSec) + point.cdrPerSec))), p._2)) |
There was a problem hiding this comment.
Could you please re-structure this huge one-liner?
I would prefer something like
maptemp.map(p =>
(p._1.copy(
points = p._1.points.map(
point=> point.copy(
and so on
| hourDiffLow/hourDiffHigh | ||
| } | ||
|
|
||
| def changeTrends(maptemp: PriorityMap[Product, Long]) : PriorityMap[Product, Long] = { |
There was a problem hiding this comment.
Please rename to randomizeTrends or something else that is more descriptive
| @@ -1,12 +1,18 @@ | |||
| package se.qvantel.generator | |||
|
|
|||
| import java.io.File | |||
There was a problem hiding this comment.
Unused imports, please remove
| p => (p._1.copy( | ||
| points = p._1.points.map( | ||
| point => point.copy( | ||
| cdrPerSec = (((Random.nextFloat()*0.2) + (-0.1))*point.cdrPerSec) + point.cdrPerSec))), p._2)) |
There was a problem hiding this comment.
Would be nice if the 10% value would be configurable in the application.conf file, but not necessary
Codecov Report
@@ Coverage Diff @@
## master #36 +/- ##
==========================================
- Coverage 35.31% 33.84% -1.48%
==========================================
Files 15 15
Lines 252 263 +11
Branches 12 11 -1
==========================================
Hits 89 89
- Misses 163 174 +11
Continue to review full report at Codecov.
|
|
Trend points will increase with a value between 0 and 10% every day. A minor bug was detected while testing and it has not been fixed. The graphs tend to "spike" at 12:00 AM when the randomizeTrends (the method which modifies the trend points) is ran. This spike is only attached to the graph which is modified first when randomizeTrends is ran. |
Trends will increase/decrease with 0-10% every day. Minor modifications in the application.conf where modifier is set from "0.01" to "0.001" and backintime from "48" to "96".