projects
/
irspy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Import calc_reliability_stats() and modify_xml_document();
[irspy-moved-to-github.git]
/
lib
/
ZOOM
/
IRSpy.pm
diff --git
a/lib/ZOOM/IRSpy.pm
b/lib/ZOOM/IRSpy.pm
index
d330113
..
2e90e79
100644
(file)
--- a/
lib/ZOOM/IRSpy.pm
+++ b/
lib/ZOOM/IRSpy.pm
@@
-18,7
+18,8
@@
use ZOOM::IRSpy::Connection;
use ZOOM::IRSpy::Stats;
use ZOOM::IRSpy::Utils qw(cql_target render_record
irspy_xpath_context irspy_make_identifier
use ZOOM::IRSpy::Stats;
use ZOOM::IRSpy::Utils qw(cql_target render_record
irspy_xpath_context irspy_make_identifier
- irspy_record2identifier);
+ irspy_record2identifier calc_reliability_stats
+ modify_xml_document);
our @ISA = qw();
our $VERSION = '1.01';
our @ISA = qw();
our $VERSION = '1.01';
@@
-305,9
+306,20
@@
sub _rewrite_irspy_record {
}
}
+my $_reliabilityField = {
+ reliability => [ reliability => 0,
+ "Calculated reliability of server",
+ "e:metaInfo/i:reliability" ],
+};
+
sub _rewrite_zeerex_record {
my($conn, $rec, $oldid) = @_;
sub _rewrite_zeerex_record {
my($conn, $rec, $oldid) = @_;
+ # Add reliability score
+ my $xc = irspy_xpath_context($rec);
+ my($nok, $nall, $percent) = calc_reliability_stats($xc);
+ modify_xml_document($xc, $_reliabilityField, { reliability => $percent });
+
my $p = $conn->package();
$p->option(action => "specialUpdate");
my $xml = $rec->toString();
my $p = $conn->package();
$p->option(action => "specialUpdate");
my $xml = $rec->toString();
@@
-317,7
+329,6
@@
sub _rewrite_zeerex_record {
# This is the expression in the ID-making stylesheet
# ../../zebra/zeerex2id.xsl
# This is the expression in the ID-making stylesheet
# ../../zebra/zeerex2id.xsl
- my $xc = irspy_xpath_context($rec);
my $id = irspy_record2identifier($xc);
if (defined $oldid && $id ne $oldid) {
warn "IDs differ (old='$oldid' new='$id')";
my $id = irspy_record2identifier($xc);
if (defined $oldid && $id ne $oldid) {
warn "IDs differ (old='$oldid' new='$id')";