forked from hummypkg/webif
improve in-progress check to accommodate padding
git-svn-id: file:///root/webif/svn/pkg/webif/trunk@3197 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
f72cf64cce
commit
8ed615459f
@ -83,15 +83,16 @@ proc eventrow {event {table TBL_RESERVATION}} {
|
|||||||
set d [$event get nduration]
|
set d [$event get nduration]
|
||||||
set e $($s + $d)
|
set e $($s + $d)
|
||||||
set n [clock seconds]
|
set n [clock seconds]
|
||||||
|
lassign [$event padded 1] sp ep
|
||||||
|
|
||||||
if {$n > $e && [$event get ersvtype] <= 3} {
|
if {$n > $e + $ep && [$event get ersvtype] <= 3} {
|
||||||
set ended 1
|
set ended 1
|
||||||
incr num_ended
|
incr num_ended
|
||||||
} else {
|
} else {
|
||||||
set ended 0
|
set ended 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if {$d > 0 && $n >= $s && $n < $e} {
|
if {$d > 0 && $n >= $s - $sp && $n < $e + $ep} {
|
||||||
set showing 1
|
set showing 1
|
||||||
} else {
|
} else {
|
||||||
set showing 0
|
set showing 0
|
||||||
@ -198,7 +199,8 @@ proc eventrow {event {table TBL_RESERVATION}} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if {$table ne "pending" && $showing} {
|
if {$table ne "pending" && $showing} {
|
||||||
set perc [expr [expr $n - $s] * 100 / $d]
|
set perc [expr [expr $n - ($s - $sp)] * 100 / \
|
||||||
|
($d + $sp + $ep)]
|
||||||
puts "<br>"
|
puts "<br>"
|
||||||
puts "<img class=va
|
puts "<img class=va
|
||||||
src=/images/745_1_11_Video_1REC.png>"
|
src=/images/745_1_11_Video_1REC.png>"
|
||||||
|
@ -126,11 +126,19 @@ rsv method name {} {
|
|||||||
return $name
|
return $name
|
||||||
}
|
}
|
||||||
|
|
||||||
rsv method padded {} {
|
rsv method padded {{l 0}} {
|
||||||
if {$ulPreOffset > 0 || $ulPostOffset > 0} {
|
if {$ulPreOffset > 0 || $ulPostOffset > 0} {
|
||||||
return 1
|
if {$l} {
|
||||||
|
return [list $ulPreOffset $ulPostOffset]
|
||||||
|
} else {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return 0
|
if {$l} {
|
||||||
|
return {0 0}
|
||||||
|
} else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,12 +340,22 @@ rsv method insert {{table pending} {force 0} {defer 0}} {
|
|||||||
set now [clock seconds]
|
set now [clock seconds]
|
||||||
|
|
||||||
# In-progress check
|
# In-progress check
|
||||||
if {$nsttime <= $now} {
|
if {$nsttime - $ulPreOffset <= $now} {
|
||||||
if {$table ne "pending" && $nsttime + $nduration >= $now} {
|
# Start time in the past
|
||||||
# Still showing - OK if real-time scheduling addition.
|
if {$nsttime + $nduration + $ulPostOffset >= $now} {
|
||||||
if {$action != 0 || ![rsv rtsched]} {
|
# Still showing
|
||||||
|
switch $action {
|
||||||
|
0 { # Add
|
||||||
|
# Ok if real-time scheduling in use.
|
||||||
|
if {![rsv rtsched]} {
|
||||||
|
throw 20 "Event already in progress."
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default {
|
||||||
throw 20 "Event already in progress."
|
throw 20 "Event already in progress."
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} elseif {$action == 0} {
|
} elseif {$action == 0} {
|
||||||
throw 20 "Event has finished."
|
throw 20 "Event has finished."
|
||||||
|
Loading…
Reference in New Issue
Block a user