Getting statistics by Genre

Before the upgrade to 3.3.0.7 from 3.1.2.1, we have custom code that we used to display statistics for views and downloads based on Abstract and each genre (or file type). After porting this code to 3.3.0.7 only the Abstract views are displayed via the method getViews(), however the breakdown of the file types is not working and we are using the method getViewsByGenre(). Is there a new method that can enable me get the same behaviour we used to have? Below is the code snippet.

<ul style="list-style: none; padding: 0; margin: 0;">
<li style="padding: 5px 0;">{translate key="article.abstract"} <span class="task_count" style="display: inline-block;width: 20px;height: 20px;margin-left: 0.5em;border-radius: 50%;background: #ddd;line-height: 20px; text-align: center; font-size: 12px; float: right;">{$article->getViews()}</span></li>

{if is_a($article, 'PublishedArticle')}{assign var=galleys value=$article->getGalleys()}{/if}
{if $galleys}
{foreach from=$galleys item=galley name=galleyList}
{assign var=fil value=$galley->getFile()}
<li style="padding: 5px 0;">{$galley->getGalleyLabel()} <span class="task_count" style="display: inline-block;width: 20px;height: 20px;margin-left: 0.5em;border-radius: 50%;background: #ddd;line-height: 20px; text-align: center; font-size: 12px; float: right;">{$fil->getViewsByGenre()}<span></li>
{/foreach}
{/if}
</ul>

Hi @Nason_Bimbe

Was that getViewsByGenre method a customization? I’ve searched the 3.1.2 code base for it and it does not exist.

In any case, beginning in 3.2 galleys are no longer assigned directly to submissions, since there is now Versioning and galleys are associated with Publication objects, which are versions of submissions. There’s still a short cut method to get galleys from submissions but you may have better luck dealing directly with publication objects now. There are lots of examples of working with those in the updated theme templates in 3.3.0.8.

Best
Jason