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

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Medium Medium
    • 4.3.0beta1
    • 4.2.0, 4.3.0alpha1
    • Documentation, Misc
    • 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

            andre1 andre1
            883497a7-55b4-4ba6-9e12-afdebb5179f9@accounts.ibexa.co Robert Röttger@xrow.de
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: