def test_table_for_author_stats_with_header(self): author_stats = self.db.get_author_stats("Author1") author = { "name": "Author1", "Conference": author_stats[0], "Journal": author_stats[1], "Book": author_stats[2], "Book Chapter": author_stats[3], "first": author_stats[4], "last": author_stats[5], "sole": author_stats[6], "Total": author_stats[7], "coauthors": author_stats[8], } table_for_html_generation = utils.author_all_stats_table(author) self.assertEqual( ( "Name", "Conference Papers", "Journal", "Book", "Book Chapters", "No. of first author", "No. of last author", "No. of sole author", "Total Publications", "Co-authors", ), table_for_html_generation[0], ) self.assertEquals([["Author1", "1", "1", "0", "1", "1", "0", "1", "3", "3"]], table_for_html_generation[1])
def displayAuthorStats(authorname, args): db = app.config['DATABASE'] try: author_stats = db.get_author_stats(authorname) author = {'name':authorname, "Conference": author_stats[0], "Journal": author_stats[1], "Book": author_stats[2], "Book Chapter": author_stats[3], "first": author_stats[4], "last": author_stats[5], "sole": author_stats[6], "Total": author_stats[7], "coauthors": author_stats[8]} args['data'] = utils.author_all_stats_table(author) args['title'] = str(authorname) db.title_cache = args['title'] return render_template('search_for_author.html', args=args) except: return searchPage()