<%@ LANGUAGE="JSCRIPT" %><% // 14-Feb-09 rbd New edit, from status.asp // 18-Jan-11 rbd GEM:300 Properly account for Observation.SetCount. // 05-Feb-12 rbd Copyright to 2012 // 05-Jan-14 rbd Copyright to 2014, navigation notes // GEM:1063 Fix plan state % listings. // 22-Jan-14 rbd GEM:1083 No more DBRelay hack :-) // 17-Dec-14 rbd GEM:1266 Light style, factor out the status-specific // styles into new style.css stylesheets. // 30-Jan-14 rbd GEM:927 Everyone gets to see all requests // 07-Jun-16 rbd GEM:1456 Color code active/run, completion and fail columns // 16-Jun-18 rbd No GEM - Update copyright // 18-Aug-18 rbd GEM:1625 ACT column not red any more, only status. // 17-Jan-19 rbd GEM:1660 Modern DOCTYPE and HTML declarations // 07-Jan-20 rbd No GEM - Copyright to 2021 // 13-Sep-23 rbd No GEM - Copyright to 2023 // // Enhance String with a trim() method // String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }; var DB = Scheduler.Database; Response.ExpiresAbsolute = new Date("Jan 1, 2000").getVarDate(); // Expire even with clock offsets Response.AddHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); // // URL must include a query string rid=NNN, where NNN is the Project ID // var idR = parseInt(Request.Form("rid").Item); // Project ID var R = DB.Project(idR); // The project! %> ACP Schedule Browser ACP Scheduler <% var tr = ""; var tre = "\r\n"; var td = "\r\n"; var tdd = "
Plans for Project <%= R.Name %>
Click the Project name above to return to Projects
Click a Plan name below to see its Observations
Plan Status Obs Imgs Time Act Cmpl Fail Dis
"; var tde = ""; function dispTime(t) { if(t >= 3600) { t /= 3600; return t.toFixed(2) + "h"; } else { t /= 60; return t.toFixed(1) + "min"; } } var eP = new Enumerator(R.Plans); for(;!eP.atEnd(); eP.moveNext()) { var P = eP.item(); var status; switch(P.Status) { case 0: status = "Pending"; break; case 1: status = "Deferred"; break; case 2: status = "Running"; break; case 3: status = "Completed"; break; case 4: status = "Failed"; break; case 5: status = "Disabled"; break; } var totImg = 0; var totTime = 0; var totAct = 0; var totCompl = 0; var totFail = 0; var totDis = 0; var eO = new Enumerator(P.Observations); for(;!eO.atEnd(); eO.moveNext()) { O = eO.item(); var eI = new Enumerator(O.Images); var iImgs = 0; var iTime = 0; var iAct = 0; var iCompl = 0; var iFail = 0; var iDis = 0; for(;!eI.atEnd(); eI.moveNext()) { I = eI.item(); iImgs += I.RepeatCount; iTime += I.ExposureInterval * I.RepeatCount; switch(I.Status) { case 0: iAct += I.RepeatCount; break; case 1: iAct += I.RepeatCount; break; case 2: iCompl += I.RepeatCount; break; case 3: iFail += I.RepeatCount; break; case 4: iDis += I.RepeatCount; break; } } totImg += iImgs * O.SetCount; totTime += iTime * O.SetCount; totAct += iAct * O.SetCount; totCompl += iCompl * O.SetCount; totFail += iFail * O.SetCount; totDis += iDis * O.SetCount; } totAct = (totAct / totImg) * 100; totCompl = (totCompl / totImg) * 100; totFail = (totFail / totImg) * 100; totDis = (totDis / totImg) * 100; Response.Write(tr); Response.Write(td + "" + P.Name + "" + tde); Response.Write(td + status + tde); Response.Write(td + P.Observations.Count + tde); Response.Write(td + totImg + tde); Response.Write(td + dispTime(totTime) + tde); if(P.Status != 5 && P.ObservationCount !== 0 ) { if(totAct > 0) Response.Write(td + totAct.toFixed(1) + "%" + tde); else Response.Write(td + "0.0%" + tde); if(totCompl == 100) { Response.Write(td + "" + totCompl.toFixed(1) + "%" + tde); } else if(totCompl > 80) { Response.Write(td + "" + totCompl.toFixed(1) + "%" + tde); } else { Response.Write(td + totCompl.toFixed(1) + "%" + tde); } if(totFail > 0) Response.Write(td + "" + totFail.toFixed(1) + "%" + tde); else Response.Write(td + "0.0%" + tde); Response.Write(td + totDis.toFixed(1) + "%" + tde); } else { Response.Write(tdd + "---" + tde); Response.Write(tdd + "---" + tde); Response.Write(tdd + "---" + tde); Response.Write(tdd + "---" + tde); } Response.Write(tre); } %>