Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-15371

object_count_by_user_id counts empty-non-published drafts

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 4.2.0, 4.3.0alpha1
    • Fix Version/s: 4.3.0beta1
    • Component/s: Documentation, Misc
    • Labels:
      None

      Description

      this bugreport is related to that one: http://issues.ez.no/IssueView.php?Id=15355&ProjectId=3

      to understand the whole background you might better start reading there.

      after andre suggested me to use the cronjob to clean internal drafts (thx for the hint, worked fine ) my postcount was finally displaying what it was supposed to display but that might means that the 'object_count_by_user_id' (http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/object_count_by_user_id) fetch is bugged cause its counting drafts as well.
      informations about that you will find in the related issue mentioned upper.
      but i made other tests to confirm the problem.

      the origin situation was like that.

      a user created a forum topic and a forum reply and somehow there was a draft created by him as well in the database. so my postcount in the forum tells me that he got 3 posts but he only has 2 (forum topic+reply).

      the database looks like that:

      http://robert.web1.xrow.net/uploads/before_cronjob_DB.JPG

      frontend looks like that:

      http://robert.web1.xrow.net/uploads/before_cronjob_frontend.JPG

      {def $user_post_count=fetch( 'content', 'object_count_by_user_id', hash( 'class_id', 37, 'user_id', $owner_map.user_account.contentobject_id ) ) $user_topics_count=fetch( 'content', 'object_count_by_user_id', hash( 'class_id', 36, 'user_id', $owner_map.user_account.contentobject_id ) )}

      <p>posts:

      {sum( $user_post_count, $user_topics_count )}

      </p>

      => thats my code which is responsible for the postcount from the forum_topic.tpl

      so that looks wrong to me, why should the object_count_by_user_id also counts the "draft" which appeared however? makes no sense to me tbh.

      after andre suggested me to run the cronjobs a ran the cronjobs/internal_drafts_cleanup.php cronjob.

      many objects got deleted and as well the draft #10739.

      so my database looked like that then:

      http://robert.web1.xrow.net/uploads/after_cronjob_DB.JPG

      and my frontend finally showed me the wanted result of 2!:

      http://robert.web1.xrow.net/uploads/after_cronjob_frontend.JPG

      that prooves that 'object_count_by_user_id' also counts drafts and that is wrong in my opinion. can you confirm its a bug and can you provide a fix for it? or is there another way to fetch objects by user id without fetching the drafts as well?

        Attachments

          Activity

            People

            Assignee:
            andre1 André R
            Reporter:
            rrobert Robert Röttger@xrow.de
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: