& /htmlheader &>
<& modelheader &>
Nightly Summary
<& /htmlfooter &>
<%init>
use Astro::Time;
my $inst = $m->notes('INST');
my $mc = $inst->getConfig();
my $model = $m->notes('MODEL');
# Get basic obsTool summary output.
my @goo;
my @things;
my @cal;
my @stuff = grep !/^#/, `obsTool --instance $model --linkstuff --ocnum all 2>&1 `;
my $link_str;
my $num;
foreach (@stuff) {
@things = split /\s+/, $_;
@cal = mjd2cal($things[1]);
# Figger out link status.
$link_str = 'NOT STARTED';
$num = $things[2];
# OK, here are the rules here for displaying link progress.
# The number of linkable fields is $things[2], or $num.
# If $things[4] > 0, slow is done, and fast is completed to $things[4] / $num.
# Else if $things[3] > 0, slow is completed to $things[3] / $num.
# Else linking as not started (both == 0).
if ($things[4] == $num) {
$link_str = sprintf "COMPLETED
%d fields", $num;
}
elsif ($things[4] > 0) {
$link_str = sprintf "SLOW COMPLETE
FAST %d%% (%d/%d)", int(100 * $things[4] / ($num || 1)), $things[4], $num;
}
elsif ($things[3] > 0) {
$link_str = sprintf "SLOW %d%% (%d/%d)
FAST NOT STARTED", int(100 * $things[3] / ($num || 1)), $things[3], $num;
}
else {
$link_str = sprintf "UNLINKED";
}
push @goo, {
ocnum => $things[0],
epoch_mjd => $things[1],
date => sprintf("%4d-%02d-%02d", @cal[2, 1, 0]),
fields => $things[2],
link_status => $link_str
};
}
%init>