|
From: <bu...@us...> - 2006-04-04 14:06:29
|
Revision: 618 Author: bugant Date: 2006-04-04 07:06:18 -0700 (Tue, 04 Apr 2006) ViewCVS: http://svn.sourceforge.net/yaacs/?rev=618&view=rev Log Message: ----------- * some fixes due to the latest db-revolution; Modified Paths: -------------- trunk/yaacs/cati.tcl trunk/yaacs/tclIndex trunk/yacati.tcl trunk/yadmin.tcl Modified: trunk/yaacs/cati.tcl =================================================================== --- trunk/yaacs/cati.tcl 2006-04-04 13:02:03 UTC (rev 617) +++ trunk/yaacs/cati.tcl 2006-04-04 14:06:18 UTC (rev 618) @@ -398,20 +398,21 @@ # @param user_name the logni of the user # @return an hash containing the user infos proc ::cati::getUserInfo {db user_name} { - set str_sql "Select uid,name,surname,note from interviewers.interviewers where login::bpchar='$user_name'" + set str_sql "select uid,name,surname,note from interviewers.interviewers where login::bpchar='$user_name'" array set res_user [yadb::getTupleArray $db $str_sql] if {[array size res_user] == 0} { return [array get dummy] } - set i 0 - pg_select $db "Select idx_perform::numeric(4,1) from interviewers.int_performance where uid=$res_user(uid) order by touch desc limit 4 " rec { - if {$i==0} { - set res_user(note) "$res_user(note) - \[$rec(idx_perform)\]" - } else { - set res_user(note) "$res_user(note) \[$rec(idx_perform)\]" - } - incr i + + set lastIdxs [::bbtools::lastNCompPerf $db $res_user(uid) 4] + set strLast "" + foreach l $lastIdxs { + set strLast "$strLast\[$l\] " } + # remove useless spaces + set strLast [string trim $strLast] + set res_user(note) "$res_user(note) - $strLast" + set res_user(login) $user_name return [array get res_user] } @@ -423,9 +424,9 @@ values ('$myip',$idu,$idproj)" #creo la sessione per l'utente user_name e per l'indagine scelta - set str_sql "Select new_session($idu,$idproj)" - set res(sessione) [yadb::getTuple $db_int $str_sql 0] - set res(inizio_turno) [yadb::getTime $db_sample] + set str_sql "select log.new_session($idu,$idproj)" + set res(sessione) [yadb::getTuple $db $str_sql 0] + set res(inizio_turno) [yadb::getTime $db] yalog::debug "-- New login --" yalog::debug "Login: $nameu" @@ -433,8 +434,8 @@ yalog::debug "Session Id: $res(sessione)" yalog::debug "-- End new login --" - set turno_sql "select tstart,tend from turns where '$res(inizio_turno)' between tstart and tend \ - and idt in (select idt from tupjs where proj=$idproj and day=date(now()))" + set turno_sql "select tstart,tend from projects.turns where '$res(inizio_turno)' between tstart and tend \ + and idt in (select idt from projects.tupjs where proj=$idproj and day=date(now()))" if { [yadb::getNumTuples $db $turno_sql] != 1 } { yalog::error [mc "Warning, you are not on any schedule!"] @@ -628,7 +629,7 @@ } yalog::debug "I sign last access and busy." - set str_update "Update projects.$srvy(nome_tabella) set touch=now(), used=true where rid=$rid and cod_com=$com"; + set str_update "Update projects.$srvy(nome_tabella) set touch=now(), locked=true where rid=$rid and cod_com=$com"; yadb::execl $db $str_update; yadb::execl $db "End Work"; @@ -677,29 +678,29 @@ yalog::debug "I've not found any appointment! (consequently i close the transaction)" yalog::debug "I try to find a new free contact..." - set str_sql "Select name,retry,ouid,rid,fax::varchar,reference,history,note,cod_com, mail_addr, employee, field, \ - phone1, phone2, phone3, phone4, active_phone, dis_phone1, dis_phone2, msg_quote \ - from projects.$srvy(pjtable) \ - where touch is null and quota=false and used=false and retry <= $srvy(max_retry) \ - for update of projects.$srvy(pjtable) \ - limit 1 order by priority,rand" + set str_sql "select name,retry,ouid,rid,fax::varchar,reference,history,note,cod_com, email_addr, employee, field, \ + phone1, phone2, phone3, phone4, active_phone, dis_phone1, dis_phone2, label \ + from projects.$srvy(pjtable) as pjt\ + where touch is null and quota=false and locked=false and retry <= $srvy(max_retry) \ + order by priority,rand \ + limit 1 \ + for update of pjt" set sel [yadb::getTuple $db $str_sql 0] if {$sel == -1} { - set str_lib1 "Select count(*) from projects.$srvy(nome_tabella) \ - where touch is null and used=false and quota=false and retry<= $srvy(max_retry)" - - set r_lib [yadb::getTuple $db $str_lib 0] + set str_lib "select count(*) from projects.$srvy(pjtable) \ + where touch is null and locked=false and quota=false and retry <= $srvy(max_retry)" + set r_lib [::yadb::getTuple $db $str_lib 0] set how_much_free [lindex $r_lib 0] if { $how_much_free != 0 } { yalog::warning "Recursive retriving :)\n" - yadb::execl $db_sample "End Work"; + yadb::execl $db "End Work"; return [cati::getContact $db $idu [array get srvy]]; } yalog::warning "There are no other contacts...\n" - yadb::execl $db_sample "End Work"; + yadb::execl $db "End Work"; return [array get dummy] } @@ -710,8 +711,8 @@ yalog::debug "Mark the contact as not usable from other and update last access field." set str_update "update projects.$srvy(pjtable) set touch=now(), locked=true where rid=$res(rid) and cod_com=$res(com_sql) "; - yadb::execl $db_sample $str_update - yadb::execl $db_sample "End Work"; + yadb::execl $db $str_update + yadb::execl $db "End Work"; #add unuseful info set res(nomeapp) ""; set res(annoapp) ""; set res(sexapp) ""; return [array get res] Modified: trunk/yaacs/tclIndex =================================================================== --- trunk/yaacs/tclIndex 2006-04-04 13:02:03 UTC (rev 617) +++ trunk/yaacs/tclIndex 2006-04-04 14:06:18 UTC (rev 618) @@ -108,12 +108,6 @@ set auto_index(::bbtools::bb-stato) [list source [file join $dir bbtools.tcl]] set auto_index(::bbtools::turnHourPerInt) [list source [file join $dir bbtools.tcl]] set auto_index(::bbtools::hour_per_int) [list source [file join $dir bbtools.tcl]] -set auto_index(::yavoip::getAutodial) [list source [file join $dir yavoip_ro.tcl]] -set auto_index(::yavoip::call) [list source [file join $dir yavoip_ro.tcl]] -set auto_index(::yavoip::phoneEvent) [list source [file join $dir yavoip_ro.tcl]] -set auto_index(::yavoip::conn) [list source [file join $dir yavoip_ro.tcl]] -set auto_index(::yavoip::hangup) [list source [file join $dir yavoip_ro.tcl]] -set auto_index(::yavoip::reset) [list source [file join $dir yavoip_ro.tcl]] set auto_index(::cati::getOuidByOutcome) [list source [file join $dir cati.tcl]] set auto_index(::cati::crapOnExit) [list source [file join $dir cati.tcl]] set auto_index(::cati::check_user_connection) [list source [file join $dir cati.tcl]] Modified: trunk/yacati.tcl =================================================================== --- trunk/yacati.tcl 2006-04-04 13:02:03 UTC (rev 617) +++ trunk/yacati.tcl 2006-04-04 14:06:18 UTC (rev 618) @@ -654,7 +654,6 @@ set ::yacati::manualSave 0 ::yacati::makeCall } - } @@ -862,7 +861,7 @@ set lastIdxs [::bbtools::lastNCompPerf $db $userid 4] set strLast "" - foreach l $lastIdx { + foreach l $lastIdxs { set strLast "$strLast\[$l\] " } # remove useless spaces @@ -1330,7 +1329,7 @@ ::yacati::configureWdj bt_pause state disabled ::yacati::configureWdj bt_replay state disabled - if { $::yacati::survey(azienda) == "f" } { + if { $::yacati::survey(listed) == "f" } { ::yacati::popWdjState normal set wdj [::yacati::getWdj birthday] $wdj delete list 0 end @@ -1351,7 +1350,7 @@ $wdj delete list 0 end set i 0 pg_select $db "Select study from projects.study_degrees" rec { - $wdj insert list $i $rec(titolo) + $wdj insert list $i $rec(study) incr i } ::yacati::popWdjState disabled Modified: trunk/yadmin.tcl =================================================================== --- trunk/yadmin.tcl 2006-04-04 13:02:03 UTC (rev 617) +++ trunk/yadmin.tcl 2006-04-04 14:06:18 UTC (rev 618) @@ -1159,45 +1159,46 @@ array set survey [cati::getSurveyFromTitle $db $pjName] .pj.summ.ename delete 0 end - .pj.summ.ename insert 0 $survey(titolo) + .pj.summ.ename insert 0 $survey(name) - if {$survey(in_corso) == "t"} { + if {$survey(active) == "t"} { .pj.summ.act select } .pj.summ.edesc delete 0 end - .pj.summ.edesc insert 0 $survey(descrizione) + .pj.summ.edesc insert 0 $survey(description) - .pj.summ.nint set $survey(tentativi) + .pj.summ.nint set $survey(max_retry) if {$survey(listed) == "t"} { .pj.summ.comp select } - .pj.wt.tbusy show $survey(attesa_occupato) - .pj.wt.tnota show $survey(attesa_libero) - .pj.wt.tfax show $survey(attesa_fax) - .pj.wt.tansm show $survey(attesa_segreteria) + .pj.wt.tbusy show $survey(busy_wait) + .pj.wt.tnota show $survey(noresp_wait) + .pj.wt.tfax show $survey(fax_wait) + .pj.wt.tansm show $survey(machine_wait) .pj.stuff.maxpause.sinpause set $survey(max_pause) .pj.stuff.maxpause.sumpause set $survey(sum_pause) - + + # MOVE SQL set estra [lindex [yadb::getTuple $db "select typeof from sampling.sampling_types where id=$survey(sampling_type)" 0] 0] if {$estra == -1} {yadmin::dbError} .pj.stuff.samp delete entry 0 end .pj.stuff.samp insert entry 0 $estra - .pj.stuff.soglia configure -state normal + .pj.stuff.soglia configure -state normal .pj.stuff.soglia delete 0 end - .pj.stuff.soglia insert 0 $survey(soglia) + .pj.stuff.soglia insert 0 $survey(threshold) - if {$survey(tipo_estrazione) != 5} { + if {$survey(sampling_type) != 5} { .pj.stuff.soglia configure -state disabled } .pj.stuff.fax configure -state normal .pj.stuff.fax delete 0 end - .pj.stuff.fax insert 0 $survey(percorso_fax) + .pj.stuff.fax insert 0 $survey(fax_path) if {$survey(listed) == "f"} { .pj.stuff.fax configure -state disabled @@ -1209,7 +1210,7 @@ } .pj.stuff.mail delete 0 end - .pj.stuff.mail insert 0 $survey(percorso_mail) + .pj.stuff.mail insert 0 $survey(mail_path) .pj.stuff.invite delete 0 end .pj.stuff.invite insert 0 $survey(invite_model) @@ -1219,8 +1220,8 @@ .pj.stuff.freqm set $survey(freq_mon) - set settedStart $survey(inizio) - set settedEnd $survey(fine) + set settedStart $survey(pjstart) + set settedEnd $survey(pjend) } # fill in the turns management table. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |