Skip to content
Permalink
Browse files

rebased and ported 1740 to work with sponsorship

  • Loading branch information...
mekarpeles authored and root committed Aug 4, 2019
1 parent 738234f commit 8e55709fe347f45fffb1152fc017b8c0dcb904ab
Showing with 4 additions and 3 deletions.
  1. +3 −2 openlibrary/plugins/upstream/account.py
  2. +1 −1 openlibrary/templates/account/books.html
@@ -769,12 +769,13 @@ class public_my_books(delegate.page):

def GET(self, username, key='loans'):
"""check if user's reading log is public"""
i = web.input(page=1)
user = web.ctx.site.get('/people/%s' % username)
if not user:
return render.notfound("User %s" % username, create=False)
if user.preferences().get('public_readlog', 'no') == 'yes':
readlog = ReadingLog(user=user)
books = readlog.get_works(key)
books = readlog.get_works(key, page=i.page)
sponsorships = get_sponsored_editions(user)
page = render['account/books'](
books, key, sponsorship_count=len(sponsorships),
@@ -831,7 +832,7 @@ def GET(self, key='loans'):
'isbn_%s' % len(s['isbn']): s['isbn']
})[0]) for s in sponsorships)
else:
works = readlog.get_works(key, page=i.page)
books = readlog.get_works(key, page=i.page)
page = render['account/books'](
books, key, sponsorship_count=len(sponsorships),
reading_log=readlog.reading_log_counts, lists=readlog.lists,
@@ -8,7 +8,7 @@
$ meta_photo_url = "https://archive.org/services/img/%s" % get_internet_archive_id(user.key)

$ current_page = int(input(page=1).page)
$ total_items = int(reading_log[key])
$ total_items = int(reading_log.get(key, sponsorship_count))

$if user:
$ displayName = user.displayname

0 comments on commit 8e55709

Please sign in to comment.
You can’t perform that action at this time.