Merge pull request 'Change slotid of dummy entry to -1 in checkconfilcts to prevent confusion with real recording slot 0' (#49) from MymsMan/webif:fixIncorrectConflicts into master

Reviewed-on: hummypkg/webif#49
This commit is contained in:
prpr 2023-11-02 11:00:38 +00:00
commit 8e80e86d70

View File

@ -1525,8 +1525,8 @@ proc {rsv evaluate_conflicts} {events type thresh {debug 0}} {
lassign $ev start end hsvc eid sid
if {$debug} {
puts "\nSLOTS: $slots"
puts $ev
puts "<br>\nSLOTS: $slots"
puts "$ev - "
}
# Close off any open slots that have now finished.
@ -1588,7 +1588,7 @@ proc {rsv evaluate_conflicts} {events type thresh {debug 0}} {
lassign [lindex $slots 0] xsid xend
if {$xend >= $end} continue
if {$debug} { puts " Replacing slot 0.\n" }
if {$debug} { puts " Replacing slot 0.<br>\n" }
set uslot 0
}
@ -1604,23 +1604,27 @@ proc {rsv evaluate_conflicts} {events type thresh {debug 0}} {
proc {rsv newconflicts} {{thresh 1} {type "list"} {debug 0}} {
set events [lsort -index 0 -integer [rsv allevents]]
set conflicts [rsv evaluate_conflicts $events $type $thresh $debug]
if {$debug} {
puts "<br>\nConflicts: $conflicts"
}
if {$type eq "map"} { return $conflicts }
return [dict keys $conflicts]
}
proc {rsv checkconflict} {s d thresh {debug 0}} {
set events [rsv allevents]
lappend events [list $s $($s + $d) 0 0 0]
lappend events [list $s $($s + $d) 0 0 -1]
set events [lsort -index 0 -integer $events]
set conflicts [rsv evaluate_conflicts $events 'list' $thresh $debug]
if {$debug} {
puts "<br>\nConflicts: $conflicts"
}
set ret {}
if {![dict exists $conflicts "0"]} { return $ret }
if {![dict exists $conflicts "-1"]} { return $ret }
foreach c [dict get $conflicts 0] {
if {$c eq "0"} continue
foreach c [dict get $conflicts -1] {
if {$c eq "-1"} continue
set s [rsv slot $c]
set s [$s name]
lappend ret $s