<commit_before>package models

import models.entities._
import models.ids._
import org.joda.time.DateTime
import scala.collection.mutable
import play.api.templates.Html
import be.studiocredo.util.Joda._

object admin {
  case class RichUser(user: User, detail: UserDetail) {
    def id = user.id
    def name = user.name
    def username = user.username
    def password = <PASSWORD>
    def email = detail.email
    def address = detail.address
    def phone = detail.phone
    def addressLines: List[String] = address match {
      case None => List()
      case Some(address) => address.split("\n").toList
    }
    def active = user.active
  }

  case class RichUserWithReservationHistory(user: RichUser, otherUsers: List[User], orders: List[OrderDetail], prereservations: List[ShowPrereservationDetail], pendingPrereservations: PendingPrereservationDisplay, reservationQuota: List[ReservationQuotumDetail], unusedQuota: UnusedQuotaDisplay) {
    def prereservationsByShow: Map[EventShow, List[ShowPrereservationDetail]] = {
      prereservations.groupBy(_.show)
    }

    def unusedPreReservationsByShow: Map[EventShow, Int] = {
      pendingPrereservations.showMap
    }

    def shows: List[EventShow] = {
      (prereservations.map{_.show} ++ pendingPrereservations.showMap.keys).distinct.sortBy(_.date)
    }

    def events: List[Event] = {
      (reservationQuota.map{_.event} ++ unusedQuota.eventMap.keys).distinct
    }

    def quotaByEvent: Map[Event, List[ReservationQuotumDetail]] = {
      reservationQuota.groupBy(_.event)
    }

    def unusedQuotaByEvent: Map[Event, Int] = {
      unusedQuota.eventMap
    }
  }

  case class UserFormData(name: String, username: String, email: Option[String], address: Option[String], phone: Option[String], active: Boolean)


  case class EventDetail(event: Event, shows: List[VenueShows], pricing: Option[EventPricing]) {
    def id = event.id
    def name = event.name
    def reservationAllowed = event.reservationAllowed
    def preReservationAllowed = event.preReservationAllowed
  }

  case class EventPrereservationsDetail(event: Event, users: List[User], shows: List[VenueShows], prereservations: List[ShowPrereservationDetail], reservationQuota: Option[Int]) {
    def id = event.id

    def prereservationsByShow(showId: ShowId): Int = {
      prereservations.collect{case sprd if sprd.show.id == showId => sprd.quantity}.sum
    }
  }

  object EventReservationsDetail {
    val maxQuantityPerReservation = 20
  }
  case class EventReservationsDetail(event: EventDetail, users: List[User], shows: List[VenueShows], pendingPrereservationsByShow: Map[ShowId, Int]) {
    def id = event.id

    def totalQuota = users.length match {
      case 0 => 0
      case 1 => 10
      case 2 => 15
      case _ => EventReservationsDetail.maxQuantityPerReservation
    } //TODO: make number of tickets per session configurable
  }

  case class ShowEdit(venueId: VenueId, date: DateTime)

  case class VenueShows(venue: Venue, shows: List[Show])

  case class VenueShow(venue: Venue, show: Show)<commit_msg>5 tickets<commit_after>package models

import models.entities._
import models.ids._
import org.joda.time.DateTime
import scala.collection.mutable
import play.api.templates.Html
import be.studiocredo.util.Joda._

object admin {
  case class RichUser(user: User, detail: UserDetail) {
    def id = user.id
    def name = user.name
    def username = user.username
    def password = <PASSWORD>
    def email = detail.email
    def address = detail.address
    def phone = detail.phone
    def addressLines: List[String] = address match {
      case None => List()
      case Some(address) => address.split("\n").toList
    }
    def active = user.active
  }

  case class RichUserWithReservationHistory(user: RichUser, otherUsers: List[User], orders: List[OrderDetail], prereservations: List[ShowPrereservationDetail], pendingPrereservations: PendingPrereservationDisplay, reservationQuota: List[ReservationQuotumDetail], unusedQuota: UnusedQuotaDisplay) {
    def prereservationsByShow: Map[EventShow, List[ShowPrereservationDetail]] = {
      prereservations.groupBy(_.show)
    }

    def unusedPreReservationsByShow: Map[EventShow, Int] = {
      pendingPrereservations.showMap
    }

    def shows: List[EventShow] = {
      (prereservations.map{_.show} ++ pendingPrereservations.showMap.keys).distinct.sortBy(_.date)
    }

    def events: List[Event] = {
      (reservationQuota.map{_.event} ++ unusedQuota.eventMap.keys).distinct
    }

    def quotaByEvent: Map[Event, List[ReservationQuotumDetail]] = {
      reservationQuota.groupBy(_.event)
    }

    def unusedQuotaByEvent: Map[Event, Int] = {
      unusedQuota.eventMap
    }
  }

  case class UserFormData(name: String, username: String, email: Option[String], address: Option[String], phone: Option[String], active: Boolean)


  case class EventDetail(event: Event, shows: List[VenueShows], pricing: Option[EventPricing]) {
    def id = event.id
    def name = event.name
    def reservationAllowed = event.reservationAllowed
    def preReservationAllowed = event.preReservationAllowed
  }

  case class EventPrereservationsDetail(event: Event, users: List[User], shows: List[VenueShows], prereservations: List[ShowPrereservationDetail], reservationQuota: Option[Int]) {
    def id = event.id

    def prereservationsByShow(showId: ShowId): Int = {
      prereservations.collect{case sprd if sprd.show.id == showId => sprd.quantity}.sum
    }
  }

  object EventReservationsDetail {
    val maxQuantityPerReservation = 5 
  }
  case class EventReservationsDetail(event: EventDetail, users: List[User], shows: List[VenueShows], pendingPrereservationsByShow: Map[ShowId, Int]) {
    def id = event.id

    def totalQuota = users.length match {
      case 0 => 0
      case 1 => 5 
      case 2 => 5
      case _ => EventReservationsDetail.maxQuantityPerReservation
    } //TODO: make number of tickets per session configurable
  }

  case class ShowEdit(venueId: VenueId, date: DateTime)

  case class VenueShows(venue: Venue, shows: List[Show])

  case class VenueShow(venue: Venue, show: Show)
{'fraction_non_alphanumeric': 0.10031040679627512, 'fraction_numerical': 0.0029406959647116484, 'mean_word_length': 4.034539473684211, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '4588080', 'n_tokens_mistral': 1921, 'n_tokens_neox': 1868, 'n_words': 444}