if { !$test_run_p } { db_dml sql "update im_hours h set hours = h.hours + :hours where h.project_id = :target_project_id and h.user_id = :user_id and h.day = :day" }
if { !$test_run_p } { db_dml sql "update im_hours h set (hours, note) values (h.hours + :hours, h.note || ', ' || :note) where h.project_id = :target_project_id and h.user_id = :user_id and h.day = :day" }
if { !$test_run_p } { db_dml sql "update im_hours h set hours = h.hours + :hours where h.project_id = :target_project_id and h.user_id = :user_id and h.day = :day" }
if { !$test_run_p } { db_dml sql "update im_hours h set (hours, note) values (:hours, :note) where h.project_id = :target_project_id and h.user_id = :user_id and h.day = :day" }
} elseif { $hours == 0 } {
# create im_hours record
if { !$test_run_p } {
if {[catch{
db_dml insert_hour "insert into im_hours (user_id,project_id,day,hours) values (:user_id,:target_project_id,:day,:hours)"
db_dml insert_hour "insert into im_hours (user_id,project_id,day,hours,note) values (:user_id,:target_project_id,:day,:hours,:note)"