auto commit on 2019-07-05 18:23
authorKilian Saffran <ksaffran@dks.lu>
Fri, 5 Jul 2019 16:23:30 +0000 (18:23 +0200)
committerKilian Saffran <ksaffran@dks.lu>
Fri, 5 Jul 2019 16:23:30 +0000 (18:23 +0200)
apps/data/db/lechatpotte.sqlite
apps/data/db/underatert.sqlite
apps/tmpl/creorga/modules/staff/js/coworker.js

index 0c99976..4244aaa 100644 (file)
Binary files a/apps/data/db/lechatpotte.sqlite and b/apps/data/db/lechatpotte.sqlite differ
index ff7c7a9..3c6da64 100644 (file)
Binary files a/apps/data/db/underatert.sqlite and b/apps/data/db/underatert.sqlite differ
index 7b01ad2..a210001 100644 (file)
@@ -247,11 +247,11 @@ function load_table_vacancy() {
   " from (" +
   "select vc.uuid,vc.vacyear,vc.datefrom,vc.dateto,vc.type,vc.description,vc.accepted," +
   "((strftime('%s',vc.dateto) - strftime('%s',vc.datefrom)) /84600) + 1 as days," +
-  "((((strftime('%s',vc.dateto) - strftime('%s',vc.datefrom)) /84600) + 1) / 7) * (7 - (st.weekhours / st.maxdayhours)) as day_to_much," +
+  "((((strftime('%s',vc.dateto) - strftime('%s',vc.datefrom)) /84600) + 2) / 7) * (7 - (st.weekhours / st.maxdayhours)) as day_to_much," +
   "(select count(v.vacancydate) from vacancy v where v.vacancydateto is null and strftime('%s',v.vacancydate) not in ('0','6') and v.vacancydate between vc.datefrom and vc.dateto) as vdays,st.weekhours,st.weekhours / maxdayhours as days_per_week,vc.timefrom,vc.timeto,st.maxdayhours, " +
   "cast(cast(strftime(\"%s\",vc.timeto) as int)- cast(strftime(\"%s\",vc.timefrom) as int) as real)/3600 as hours " +
   "from vacancycalendar vc join staff st on (vc.staffuuid=st.uuid) where vc.staffuuid='"+ pconfig.uuid+"' and vc.vacyear=" + pconfig.year+"));";
-  
+  //days_to_much => +2 for sat+sun => +1 for saturday icluded
 
 var vacdata = parent.appdb.dbquery(vacdatasql);
   var sums = { normal:0,except:0,ill:0,normal_ok:0,except_ok:0,ill_ok:0};
@@ -493,7 +493,7 @@ $("#vacancylastyearrest").val(0);
 
 function set_selectyears() {
    
-  var years = parent.appdb.dbquery("select COALESCE((select cast(min(vacancyyear) as TEXT) as minyear from staffvacancydays where staffuuid='4b86fe07-d175-c74e-aafc-40e2275f3b6d'),strftime('%Y',coalesce(min(entrydate),date('now','-1 year')))) as minyear,strftime('%Y',date('now', '+1 year')) as maxyear from staff where uuid='"+pconfig.uuid+"';");
+  var years = parent.appdb.dbquery("select COALESCE((select cast(min(vacancyyear) as TEXT) as minyear from staffvacancydays where staffuuid='" + pconfig.uuid + "'),strftime('%Y',coalesce(min(entrydate),date('now','-1 year')))) as minyear,strftime('%Y',date('now', '+1 year')) as maxyear from staff where uuid='"+pconfig.uuid+"';");
   var minyear = parseInt(years.sqldata[0].minyear);
   var maxyear = parseInt(years.sqldata[0].maxyear);
   for (var y=minyear;y<=maxyear;y++){