Commit 0d852a6d authored by Petter Goksøyr Åsen's avatar Petter Goksøyr Åsen
Browse files

DEICH-5834 index koha rating on publication (WIP some more)

parent ad42c6a9
......@@ -59,6 +59,7 @@ const (
st.issuesByYear,
st.popularity,
st.rating,
st.numRatings,
bmt.value AS publicationURI
FROM biblio_stats st
LEFT JOIN items i ON(st.biblionumber = i.biblionumber AND i.deleted_on IS NULL AND i.notforloan != 1 AND i.damaged=0 AND i.itemlost NOT IN(1,8,12))
......
......@@ -226,6 +226,7 @@ func (c kohaCollector) fetchBiblioStats() (map[uint32]biblio.KohaBiblio, error)
var issuesByYear json.RawMessage
var popularity float64
var rating float64
var numRatings uint32
var publication string
biblios := make(map[uint32]biblio.KohaBiblio, numBiblios)
......@@ -237,7 +238,7 @@ func (c kohaCollector) fetchBiblioStats() (map[uint32]biblio.KohaBiblio, error)
defer rows.Close()
for rows.Next() {
if err := rows.Scan(&biblionumber, &numItems, &homeBranches, &branchAvailability, &locations, &reservesByYear, &issuesByYear, &popularity, &rating, &publication); err != nil {
if err := rows.Scan(&biblionumber, &numItems, &homeBranches, &branchAvailability, &locations, &reservesByYear, &issuesByYear, &popularity, &rating, &numRatings, &publication); err != nil {
logger.Infof("fetchBiblioStats failed after %s", time.Since(start))
return nil, err
}
......@@ -253,6 +254,7 @@ func (c kohaCollector) fetchBiblioStats() (map[uint32]biblio.KohaBiblio, error)
IssuesByYear: json.RawMessage(issuesByYear),
KohaPopularity: popularity,
KohaRating: rating,
KohaNumRatings: numRatings,
}
}
logger.Debugf("fetchBiblioStats took %s", time.Since(start))
......
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