<commit_before>package im.mange.shoreditch.engine.model

import org.joda.time.DateTime
import im.mange.shoreditch.engine.hipster.Script
import org.joda.time.DateTimeZone._
import im.mange.shoreditch.engine.hipster.VersionedService
import scala.Some

object TestRunReport {
  def create(test: Test, script: Script, services: List[VersionedService]) =
    TestRunReport(
      test.id, script.testRunId.get,
      script.startedAt.map(_.toDateTime(UTC)), script.completedAt.map(_.toDateTime(UTC)),
      services.map(vs => {
        vs.offering match {
          case Some(o) => ServiceSummary(vs.alias, Some(o.env), Some(o.version))
          case None => ServiceSummary(vs.alias, None, None)
        }
      }),
      ScriptSummary(
        test.name,
        script.steps.map(st => StepSummary(st.mangledDescription, st.completedAt))
      ),
      if (script.successful) Nil else script.abortedBecause.fold(List("?????"))(r => r)
    )
}

//TODO: this is probably what we should send to the comet actor (i.e. what ScriptEventListener should use)
//TODO: indicate missing=true
case class ServiceSummary(alias: String, env: Option[String], version: Option[String])
//TODO: I should hold failures
case class StepSummary(description: String, completed: Option[DateTime])
case class ScriptSummary(description: String, steps: Seq[StepSummary])

case class TestRunReport(testId: String, testRunId: String, started: Option[DateTime], completed: Option[DateTime],
                         services: List[ServiceSummary], script: ScriptSummary, failures: List[String]) {

  def successful = failures.isEmpty
}
//TODO: add who ran it
//TODO: host these in a service so we can be fetched by test run id
<commit_msg>actually indicate when a step was started<commit_after>package im.mange.shoreditch.engine.model

import org.joda.time.DateTime
import im.mange.shoreditch.engine.hipster.Script
import org.joda.time.DateTimeZone._
import im.mange.shoreditch.engine.hipster.VersionedService
import scala.Some

object TestRunReport {
  def create(test: Test, script: Script, services: List[VersionedService]) =
    TestRunReport(
      test.id, script.testRunId.get,
      script.startedAt.map(_.toDateTime(UTC)), script.completedAt.map(_.toDateTime(UTC)),
      services.map(vs => {
        vs.offering match {
          case Some(o) => ServiceSummary(vs.alias, Some(o.env), Some(o.version))
          case None => ServiceSummary(vs.alias, None, None)
        }
      }),
      ScriptSummary(
        test.name,
        script.steps.map(st => StepSummary(st.mangledDescription, st.startedAt, st.completedAt))
      ),
      if (script.successful) Nil else script.abortedBecause.fold(List("?????"))(r => r)
    )
}

//TODO: this is probably what we should send to the comet actor (i.e. what ScriptEventListener should use)
//TODO: indicate missing=true
case class ServiceSummary(alias: String, env: Option[String], version: Option[String])
//TODO: I should hold failures
case class StepSummary(description: String, started: Option[DateTime], completed: Option[DateTime])
case class ScriptSummary(description: String, steps: Seq[StepSummary])

case class TestRunReport(testId: String, testRunId: String, started: Option[DateTime], completed: Option[DateTime],
                         services: List[ServiceSummary], script: ScriptSummary, failures: List[String]) {

  def successful = failures.isEmpty
}
//TODO: add who ran it
//TODO: host these in a service so we can be fetched by test run id

{'fraction_non_alphanumeric': 0.1172750790457028, 'fraction_numerical': 0.0, 'mean_word_length': 3.9643366619115548, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5012678', 'n_tokens_mistral': 1024, 'n_tokens_neox': 1007, 'n_words': 277}