2015-01-22 3 views
-1

강사가있는 자동차의 예약 시스템을 만들고 기본적으로 제대로 작동하고 있습니다. 추가 세션을 차단하고 싶다는 규칙을 구현하고 싶습니다.ColdFusion에서 특정 시간대를 건너 뛰는 방법

예를 들어 강사는 세션을 6 시부 터 8 시까 지 끝냅니다. 그들이 다시 예약하고 8:15 AM (휴식을 원할 경우)으로 결정하면 다음 사용 가능한 슬롯은 8AM이어야합니다. 105분에게 범위를 withing에 다른 세션에서 하나 내가 알아낼 오전 10시

<cfloop index="ii" from="#startHour#" to="#endHour#"> 
<cfloop index="jj" from="0" to="#60-locbtwMinute#" step="#locbtwMinute#"> 
    <cfset showtime="y"> 
    <cfset time = createtime(ii, jj, 0)> 

     <cfloop query="qAssignedSessions"> 

      <cfset preSessionStart = dateadd("n",-locBtwSpan-buffertime,sessionstart)> 
      <cfset postSessionend = dateadd("n",bufferTime,sessionend)> 

      <cfif (hour(time) gt hour(preSessionStart) or (hour(time) eq hour(preSessionStart) and minute(time) gt minute(preSessionStart))) 
             and (hour(time) lt hour(postSessionend) or (hour(time) eq hour(postSessionend) and minute(time) lt minute(postSessionend)))> 
            <cfset showtime="n"> 
           </cfif> 
          </cfloop> 

          <cfif ((datecompare(arguments.startDt,latestSessionDate) eq 1 and ((hour(time) eq 20 and minute(time) eq 00) or hour(time) lt 20)) 
            or (datecompare(arguments.startDt,latestSessionDate) eq 0 and ((hour(time) eq 20 and minute(time) eq 00) or (hour(time) lt 20 and hour(time) gt hour(now())))) 
             ) 
            and showtime eq "y"> 
           <option value="<cfoutput>#timeformat(time, 'HH:mm')#</cfoutput>"><cfoutput>#timeformat(time, "hh:mm tt")#</cfoutput></option> 
          </cfif> 
         </cfloop> 
        </cfloop> 
+1

나에게 데이터베이스 작업과 같은 소리가납니다. –

+0

할당 된 세션을 작동시키는 쿼리 qAssignedSessions가 있고 논리를 기반으로합니다. – user1880192

+2

이것은 논쟁이 아닙니다. 당신은 질문을했고 나는 다른 접근법을 사용할 것이라고 말했습니다. –

답변

1

난 그냥 이미 촬영 한 사용할 수와 두 번째입니다 시간 슬롯이 배열을 만들 것입니다 가능한 다음 세션 있도록 숨겨져 야 필요없는 것을 제거하십시오.

관련 문제