Skip to content

Commit

Permalink
Set renewals counts for FOLIO
Browse files Browse the repository at this point in the history
  • Loading branch information
corylown committed Jun 8, 2023
1 parent 309a3cd commit bd08b77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/models/folio/checkout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,16 @@ def renewal_count
record.dig('details', 'renewalCount') || 0
end

# nil means "unlimited" for unseenRenewalsRemaining
def unseen_renewals_remaining
Float::INFINITY
# fields['unseenRenewalsRemaining'] || Float::INFINITY
unseen_renewals_allowed - renewal_count
end

def unseen_renewals_allowed
record.dig('details', 'loanPolicy', 'renewalsPolicy', 'numberAllowed') || Float::INFINITY
end

# nil means "unlimited" for seenRenewalsRemaining
def seen_renewals_remaining
Float::INFINITY
# fields['seenRenewalsRemaining'] || Float::INFINITY
end

def library_key
Expand Down
3 changes: 3 additions & 0 deletions app/services/folio_graphql_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ def patron_info(patron_uuid)
loanPolicy {
name
renewable
renewalsPolicy {
numberAllowed
}
loansPolicy {
period {
intervalId
Expand Down

0 comments on commit bd08b77

Please sign in to comment.