Forum Discussion

bhupen's avatar
bhupen
Advisor
10 years ago

How to increase notification number in database?

Hi All

I have case with max page size. once page size is increasing 1000 notification doesn't showing my site correctly. I want to insert 1000+ notification for my user so that I can solve this issue but Iam not sure is there any api or method to insert notification. Now I have only 50 notification in my account.

 

Is there any method so that I can insert 1000+ notification for my user? but not manually.

9 Replies

  • Is it for the testing purpose? Because 1000+ notifications will only be for a user who hasn't been active for a long time.
  • bhupen's avatar
    bhupen
    Advisor
    10 years ago

    VarunGrazittiyes the issue is when user have more than 1000+ notification then its showing widget is not displaying and site design is getting shatterd. So i want to debug this error at stage environment. For that I need to insert 1000+ notification for the user.

     

     

  • bhupen's avatar
    bhupen
    Advisor
    10 years ago

    help_1.PNG

    Please find attached file for code.

     

     

  • bhupen's avatar
    bhupen
    Advisor
    10 years ago

    <#assign pageSize            = 5 />
                    <#assign truncateLimit       = 15 />
                    <#assign badges              = '' /> <#-- let's keep empty the badges cause we don't know if we need them -->
                    <#assign badges_i            = '' />
                    <#assign notificationPageURL = community.urls.tapestryPrefix + '/notificationfeed/page' />
                    <#assign _notificationsCount = restadmin( '/users/id/' + user.id + '/notifications/count' ).value?number />
                    <#assign notifications       = [] />
                    <#assign allowed             = [ 'kudos', 'mentions', 'solutions', 'badge', 'rank' ] />
                    <#assign notificationsPage   = 1 />
                    <#assign usedNotifications   = [] />        
                    
                    <#function getNotifications>
                    <#assign page = notificationsPage * pageSize />
                    <#assign nots = restadmin( '/users/id/' + user.id + '/notifications?restapi.response_style=view&page_size=' + page ).notifications />
                
                    <#if ( nots?size > 0 )>
                        <#list nots.notification as notification>
                            <#if ( ( !usedNotifications?seq_contains( notification_index ) ) && ( allowed?seq_contains( notification.notification_type ) ) && ( notifications?size < pageSize ) )>
                                <#assign notifications     = notifications + [notification]>
                                <#assign usedNotifications = usedNotifications + [notification_index]>
                            </#if>
                        </#list>

                    <#if ( notifications?size < pageSize && ( ( _notificationsCount - page ) > 0 ) )>
                            <#assign notificationsPage = notificationsPage + 1 />
                            <#assign go = getNotifications() />
                        </#if>
                    </#if>
                     <#assign nots = restadmin( '/users/id/' + user.id + '/notifications?restapi.response_style=view&page_size=' + page ).notifications />    
                    <#return 1 />
                </#function>

  • bhupen's avatar
    bhupen
    Advisor
    10 years ago

    VarunGrazitti  I assume this chunk making problem to execute. because there is problem with recursion:

     

    <#if ( notifications?size < pageSize && ( ( _notificationsCount - page ) > 0 ) )>
                            <#assign notificationsPage = notificationsPage + 1 />
                            <#assign go = getNotifications() />
                        </#if>