Commit fe585f7d authored by bensinober's avatar bensinober Committed by Benjamin
Browse files

DEICH-5758 koha : fix a few queries in dataquality report to exclude deleted patrons

parent 75b88752
......@@ -177,12 +177,12 @@ EOF
{ id => "users_juvenile_but_really_adult",
type => "gauge",
desc => "Lånere med lånekategori barn med alder større eller lik 15 år",
query => "SELECT COUNT(1) AS num FROM borrowers WHERE categorycode='B' AND TIMESTAMPDIFF(YEAR, dateofbirth, now()) >= 15",
query => "SELECT COUNT(1) AS num FROM borrowers WHERE categorycode='B' AND TIMESTAMPDIFF(YEAR, dateofbirth, now()) >= 15 AND deleted_at IS NULL",
},
{ id => "users_adult_but_really_juvenile",
type => "gauge",
desc => "Lånere med lånekategori voksen med alder mindre enn 15 år",
query => "SELECT COUNT(1) AS num FROM borrowers WHERE categorycode='V' AND TIMESTAMPDIFF(YEAR, dateofbirth, now()) < 15",
query => "SELECT COUNT(1) AS num FROM borrowers WHERE categorycode='V' AND TIMESTAMPDIFF(YEAR, dateofbirth, now()) < 15 AND deleted_at IS NULL",
},
{ id => "users_selfreg_with_cardnumber",
link => "https://intra.deichman.no/cgi-bin/koha/reports/deichman_reports.pl?report=users_selfreg_with_cardnumber",
......@@ -190,7 +190,7 @@ EOF
desc => "Lånere med lånekategori selvregistrert barn (registrert på nett, ID må verifiseres) eller selvregistrert voksen som har lånekortnummer",
query => <<'EOF',
SELECT categorycode, COUNT(1) AS num FROM borrowers
WHERE categorycode IN ('REGBARN','REGBARNWEB','REGVOKSEN') AND cardnumber IS NOT NULL
WHERE categorycode IN ('REGBARN','REGBARNWEB','REGVOKSEN') AND cardnumber IS NOT NULL AND deleted_at IS NULL
GROUP BY categorycode
EOF
},
......@@ -200,7 +200,7 @@ EOF
query => <<'EOF',
SELECT COUNT(1) AS num FROM borrowers b LEFT JOIN borrower_attributes ba ON
(ba.borrowernumber=b.borrowernumber AND ba.code='nncip_uri')
WHERE b.categorycode="IL" AND ba.attribute IS NULL
WHERE b.categorycode="IL" AND ba.attribute IS NULL AND b.deleted_at IS NULL
EOF
},
{ id => "users_category_temporary_location",
......@@ -231,7 +231,8 @@ EOF
{ id => "users_missing_alertsms_and_alertemail",
type => "gauge",
desc => "Lånere uten sms og epost",
query => "SELECT COUNT(1) AS num FROM borrowers WHERE (smsalertnumber IS NULL OR smsalertnumber = '') AND (alertemail IS NULL OR alertemail = '') AND deleted_at IS NULL",
query => "SELECT COUNT(1) AS num FROM borrowers WHERE (smsalertnumber IS NULL OR smsalertnumber = '')
AND (alertemail IS NULL OR alertemail = '') AND deleted_at IS NULL",
},
{ id => "users_invalid_sms_number",
type => "summary",
......@@ -242,7 +243,7 @@ EOF
{ id => "users_invalid_sms_number_with_national_prefix",
type => "gauge",
desc => "Mobilnumre med nasjonalt prefix (eks +47)",
query => "SELECT COUNT(1) AS num FROM borrowers WHERE smsalertnumber like '+%'",
query => "SELECT COUNT(1) AS num FROM borrowers WHERE smsalertnumber like '+%' AND deleted_at IS NULL",
},
{ id => "users_sms_alert_missing_number",
type => "gauge",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment