Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8734179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:47:22+00:00 2026-06-13T09:47:22+00:00

Am trying to determine whether or not to display an overtime game display flag

  • 0

Am trying to determine whether or not to display an overtime game display flag in weekly game results report.

Database game results table has 3 columns (p4,p5,p6) that represent potential overtime game period score total ( for OT, Double OT, and Triple OT respectively). These columns are mapped to Option[Int] in application layer.

Currently I am filtering through game result teamA, teamB pairs, but really I just want to know if an OT game exists of any kind (vs. stepping through the collection).

def overtimeDisplay(a: GameResult, b: GameResult) = {
  val isOT = !(List(a,b).filter(_.p4.isDefined).filter(_.p5.isDefined).filter(_.p6.isDefined).isEmpty)
  if(isOT) {
    <b class="b red">
    {List( ((a.p4,a.p5,a.p6),(b.p4,b.p5,b.p6)) ).zipWithIndex.map{
      case( ((Some(_),None,None), (Some(_),None,None)), i)=> "OT"
      case( ((Some(_),Some(_),None), (Some(_),Some(_),None )), i)=> "Double OT"
      case( ((Some(_),Some(_),Some(_)), (Some(_),Some(_),Some(_) )), i)=> "Triple OT"
    }}
    </b>
  }
  else scala.xml.NodeSeq.Empty
}

Secondarily, the determination of which type of overtime to display, currently that busy pattern match (which, looking at it now, does not appear cover all the scoring scenarios), could probably be done in a more functional/concise manner.

Feel free to lay it down if you have the better way.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:47:23+00:00Added an answer on June 13, 2026 at 9:47 am

    Not sure if I understand the initial code correctly, but here is an idea:

    val results = List(a, b).map(r => Seq(r.p4, r.p5, r.p6).flatten)
    val isOT = results.exists(_.nonEmpty)
    val labels = IndexedSeq("", "Double ", "Triple ")
    results.map(p => labels(p.size - 1) + "OT")
    

    Turning score column to flat list in first line is crucial here. You have GameResult(p4: Option[Int], p5: Option[Int], p6: Option[Int]) which you can map to Seq[Option[Int]]: r => Seq(r.p4, r.p5, r.p6) and later flatten to turn Some[Int] to Int and get rid of None. This will turn Some(42), None, None into Seq(42).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With jQuery I am trying to determine whether or not <div> has content in
I am trying to determine whether or not a file has been compressed with
I'm trying to determine whether or not the user has voted on a certain
I am trying to determine whether a company has websites built with ASP.NET MVC
I'm trying to determine whether or not a string contains a number. This doesn't
I'm trying to determine whether or not a simple caching trick will actually be
I'm trying to determine whether or not two strings match, and even though when
Im trying to use typeof to determine whether or not a variable is undefined:
I'm trying to diff two strings to determine whether or not they solely vary
I'm trying to determine whether or not a expression passed into my Expressions class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.