Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 18 2022 19:35
    @SethTisue banned @lunaterra22
  • Sep 14 2022 18:08
    @SethTisue banned @discjock:matrix.org
  • Sep 12 2022 20:37
    @SethTisue banned @manuelzamoratetherbtcusa:matrix.org
  • Sep 06 2022 14:29
    @SethTisue banned @white_hat_hacker:minds.com
  • Sep 06 2022 14:29
    @SethTisue banned @alexchole:matrix.org
  • Aug 31 2022 17:03
    @SethTisue banned @andersonwatts7:matrix.org
  • Jul 19 2022 20:37
    @SethTisue banned @tonyobanon
  • Jan 02 2022 23:58
    @SethTisue banned @fakubishes:nerdsin.space
  • Dec 15 2021 05:01
    som-snytt commented #12516
  • Dec 15 2021 04:38
    SethTisue edited #1312
  • Dec 15 2021 04:38
    SethTisue opened #2273
  • Dec 15 2021 04:31
    jackkoenig opened #12516
  • Dec 15 2021 04:29
    SethTisue edited #1312
  • Dec 15 2021 04:28
    SethTisue edited #1312
  • Dec 15 2021 04:27
    SethTisue labeled #9831
  • Dec 15 2021 04:27
    scala-jenkins milestoned #9831
  • Dec 15 2021 04:27
    SethTisue labeled #9831
  • Dec 15 2021 04:27
    SethTisue opened #9831
  • Dec 15 2021 03:35
    som-snytt commented #11339
  • Dec 15 2021 03:27
    som-snytt labeled #12494
Ichoran
@Ichoran
It's super easy to add 15 minutes.
Naftoli Gugenheim
@nafg
I guess my question is still not clear.
Ichoran
@Ichoran
Just use the methods on the java.time classes to generate your later times from the start time.
Naftoli Gugenheim
@nafg
Let me post code I have currently
Ichoran
@Ichoran
No, sorry, it's not clear at all.
Naftoli Gugenheim
@nafg
  override def computeTimes(sunset: LocalTime): Stream[(LocalTime, SchedulingCapacities)] = {
    val timesStream =
      Stream.iterate(scheduleWeekdayTimes.firstTime.forSunset(sunset))(_ plusMinutes 15)

    def loop(scheduleWeekdayTimesSpans: List[ScheduleWeekdayTimesSpan],
             times: Stream[LocalTime]): Stream[(LocalTime, SchedulingCapacities)] =
      scheduleWeekdayTimesSpans match {
        case Nil           => Stream.Empty
        case span :: spans =>
          val repeated = times zip Stream.continually(span.schedulingCapacityies)
          val limited = span.untilClosingOf.map(scheduleWeekdayTimes.lastTimes(_)) match {
            case None                 => repeated.take(span.repeatCount)
            case Some(stopRepeatTime) => repeated.takeWhile { case (t, _) => !t.isAfter(stopRepeatTime) }   // the question relates to this line
          }
          limited ++ loop(spans, times.drop(limited.length))
      }

    loop(scheduleWeekdayTimesSpans, timesStream)
  }
Ichoran
@Ichoran
I don't understand what the problem with that line is.
Naftoli Gugenheim
@nafg
The problem is that it's broken if stopRepeatTime is 12AM or later
Then takeWhile will return 0 elements
stopRepeatTime is a LocalTime
Ichoran
@Ichoran
Which is why you don't do things day by day but keep everything!
Naftoli Gugenheim
@nafg
Keep what?
Ichoran
@Ichoran
Everything should be a full DateTime
Use DateTime
Never use just Time
Naftoli Gugenheim
@nafg
You still aren't getting it
This is the schedule being generated from the scheduling rules
This has nothing to do with reservations
It's a function day => Seq[(LocalTime, SchedulingCapacities)]
Rob Williams
@robwilliams2018_twitter
is that signature supposed to tell us something?
Naftoli Gugenheim
@nafg
Schedule means, what is are the slot times, and what are their (initial) capacities
@robwilliams2018_twitter it's supposed to tell @Ichoran that "don't do things day by day" and "keep everything" make no sense
Rob Williams
@robwilliams2018_twitter
well, he's saying
by the TIME definition of a day :)
Naftoli Gugenheim
@nafg
What?
Rob Williams
@robwilliams2018_twitter
if you have the ability to go past midnight
Ichoran
@Ichoran
All you managed to tell me is that you have a broken API that says you're going to do things day by day, but then you ask it for things on the next day and surprise! it breaks.
Rob Williams
@robwilliams2018_twitter
in your definition of a day
that tells you you should work from your own abstraction
Naftoli Gugenheim
@nafg
@Ichoran it's not broken, it's exactly the business requirement
Ichoran
@Ichoran
So, don't use that API. It is conceptually flawed.
Rob Williams
@robwilliams2018_twitter
and make translations back into time when needed
Naftoli Gugenheim
@nafg
No it's not. Your assumptions about what reservation system means are.
Fabio Labella
@SystemFw
I think @Ichoran is just saying to have your model in term of slots, and layer time on top, rather than have it in terms of time, and fit slots in there
Naftoli Gugenheim
@nafg
@SystemFw that doesn't solve anything. And arguably it already is that way.
Ichoran
@Ichoran
Then your stop time is an index, which might be more than 24, and you are done.
Er, well, more than 96
Naftoli Gugenheim
@nafg
How can stop time be an index?
It's a business requirement that it can be a wall time
Ichoran
@Ichoran
Because you chop the day into 96 blocks (24*15 minutes)
And you convert back to time when anyone needs it.
Naftoli Gugenheim
@nafg
How is that better than using a Duration?
Ichoran
@Ichoran
Your business requirement is that you have a stop time, not a duration.
Naftoli Gugenheim
@nafg
Right, but I can convert it to a Duration relative to the date's start
Ichoran
@Ichoran
If you had a duration, you already wouldn't have the question you had.
Naftoli Gugenheim
@nafg
I can easily get a Duration from a LocalDate and a LocalTime
Rob Williams
@robwilliams2018_twitter
@nafg you realize that all the time api libraries are just fronts for LONGs right? that are then just offsets?
Naftoli Gugenheim
@nafg
The question that I was trying to ask, and kept getting interrupted with irrelevant questions, was what the most idiomatic type would be
Rob Williams
@robwilliams2018_twitter
haha
Ichoran
@Ichoran
case class Slot(time: Int) is my vote.