SS S
SS S

Reputation: 1

python date time range

Let's assume that I have a lot of cards and I can create as many as cards per day. Now I want to publish those cards into public area based on time intervals. such that every body can understand that what is my next features..??. I want to display those published cards based on start_time and end_time.

requirements:

  1. Cards should be display to users only those intervals, after end_time, It will disable from published state.

  2. At the time of publishing cards, I must be consider CARDS_ALLOWED_LIMIT(2), such that there is no overlapping to each other whenever I am crossing the CARDS_ALLOWED_LIMIT.

  3. I can publish any interval time, but it will never exceeds limit on same interval.

ex: Each card have start_time and end_time and CARDS_ALLOWED_LIMIT_ON_SAME_INTERVAL= N(right now n=2)

sti --> card start time eti --> card end time

  1. TEST CASE

    st1-----et1 st2------et2 st3-----et3 st4------et4

    o/p. There was no overlapping. Success I can published all cards.

  2. TEST CASE:

    st1-------et1

     `st2------------et2`
    
             `st3-------------et3`
                                  `st4-------et4`
    

    here, st2 and st3 are overlapping, but if you observed, I am not exceed my limit for publishing. I can publish all cards.

3.TEST CASE:

st1-------------------------------------------et1

     `st2-----------------------et2`

                               `st3--------et3`

st4--------------------------et4

st5----et5(end_time ==st2)

here, first there cards valid date time ranges so that I can publish it, but if you observed that 4th card which( st4---et4) is overlapping and it exceeds my CARDS_ALLOWED_LIMIT. I am trying to publish it in b/w st1 and st2. Already I had some cards on that same interval. If I publish 4th card, it exceeds my CARDS_ALLOWED_LIMIT. So that I can't able to publish it and I have to show err_msg like, "Publishing failed due to, you already had two cards on these interval, Please change your intervals before publishing."

  1. TEST_CASE:

    st1----et1, st2----et2, st3----et3, st4------et4

    st4(start-time==st1) ------------------------et5/et4.

Success. I can publish it. If you observed that every day I had at most two cards i.e I never exceeds CARDS_ALLOWED_LIMIT on same intervals.

Upvotes: 0

Views: 88

Answers (1)

ItsMeTheBee
ItsMeTheBee

Reputation: 373

What is your question here? Please provide code snippets to show what you have done already and where you are stuck so we are able to help you =)

Upvotes: 1

Related Questions