<commit_before>package service.simpledb

import play.api.Logger
import awscala.simpledb.SimpleDBClient
import models._
import awscala.simpledb.Item
import securesocial.core.BasicProfile
import scala.concurrent.Future
import java.util.UUID
import awscala.simpledb.Domain
import scala.collection.mutable.ArrayBuffer

object Repository {
  val logger: Logger = Logger(this.getClass())

  implicit val simpleDB = new SimpleDBClient()
  private val userDomain: Domain = simpleDB.createDomain("User")
  private val projectsDomain: Domain = simpleDB.createDomain("Project")
  private val profileDomain: Domain = simpleDB.createDomain("Profile")
  private val buildTasks: Domain = simpleDB.createDomain("BuildTask")

  def findBuildTasks(id: String): Option[BuildTask] = {
    val items = buildTasks.select(s"""select projectId,
        userId,
        s3Url,
        state,
        platform,
        created,
        updated
      from BuildTask 
      where itemname() = '$id'""")

    items.map(item => {
      val projectId = attrValue(item, "projectId")
      val userId = attrValue(item, "userId")
      val s3Url = attrOption(item, "s3Url")
      val project = findProjectById(projectId, true).get
      val user = findUser(userId).get
      val platform = attrValue(item, "platform")
      val state = attrValue(item, "state")

      BuildTask(id = item.name,
        project = project,
        user = user,
        state = "NEW",
        s3Url = s3Url,
        platform = platform)
    }).headOption
  }

  def findNewBuildTasks(platform: String): Seq[BuildTask] = {
    val items = buildTasks.select(s"""select projectId,
      userId,
      s3Url
      from BuildTask 
      where state = 'NEW' and platform = '$platform'""")<commit_msg>findBuildTask set state to "NEW", which was wrong.<commit_after>package service.simpledb

import play.api.Logger
import awscala.simpledb.SimpleDBClient
import models._
import awscala.simpledb.Item
import securesocial.core.BasicProfile
import scala.concurrent.Future
import java.util.UUID
import awscala.simpledb.Domain
import scala.collection.mutable.ArrayBuffer

object Repository {
  val logger: Logger = Logger(this.getClass())

  implicit val simpleDB = new SimpleDBClient()
  private val userDomain: Domain = simpleDB.createDomain("User")
  private val projectsDomain: Domain = simpleDB.createDomain("Project")
  private val profileDomain: Domain = simpleDB.createDomain("Profile")
  private val buildTasks: Domain = simpleDB.createDomain("BuildTask")

  def findBuildTasks(id: String): Option[BuildTask] = {
    val items = buildTasks.select(s"""select projectId,
        userId,
        s3Url,
        state,
        platform,
        created,
        updated
      from BuildTask 
      where itemname() = '$id'""")

    items.map(item => {
      val projectId = attrValue(item, "projectId")
      val userId = attrValue(item, "userId")
      val s3Url = attrOption(item, "s3Url")
      val project = findProjectById(projectId, true).get
      val user = findUser(userId).get
      val platform = attrValue(item, "platform")
      val state = attrValue(item, "state")

      BuildTask(id = item.name,
        project = project,
        user = user,
        state = state,
        s3Url = s3Url,
        platform = platform)
    }).headOption
  }

  def findNewBuildTasks(platform: String): Seq[BuildTask] = {
    val items = buildTasks.select(s"""select projectId,
      userId,
      s3Url
      from BuildTask 
      where state = 'NEW' and platform = '$platform'""")
{'fraction_non_alphanumeric': 0.10406596531134489, 'fraction_numerical': 0.0034119988626670457, 'mean_word_length': 3.285018270401949, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5379247', 'n_tokens_mistral': 1031, 'n_tokens_neox': 1020, 'n_words': 264}