The active date facet item gets its count doubled due to special handling of the active item not being taken into consideration.

Comments

moonray’s picture

Status: Active » Needs review
StatusFileSize
new1.45 KB

Attached patch fixes this.

Status: Needs review » Needs work

The last submitted patch, search_api-active_date_facet_item_count_doubled-2113277-1.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Postponed (maintainer needs more info)

Please create patches always relative to the module directory, so they can be tested automatically (and also applied by others more easily).

Regarding your reported problem, I cannot reproduce it. If I ouput $variables in theme_facetapi_link_active(), it shows the correct count both with and without your patch. Are you sure this isn't caused by some other module, or custom code? Can you reproduce the problem from a clean install? With what steps?

moonray’s picture

The backend was search_api_db
My date facet was set to granularity: year

I was planning to redo the patch, but haven't gotten around to it. Apologies.

I'm going to try this on a clean install, but I'm quite positive that there is no other module interfering with the count.

drunken monkey’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.23 KB

Ah, the backend seems to be irrelevant but the granularity is the key factor! Good, that you mention it. It seems the bug only occurs if the active item is also of the smallest available granularity.
I don't pretend to understand what's going on in the code and in Facet API there, but your patch seems to fix it without introducing any other problems, as far as I can see. So, thank you very much for that!

Attached is a re-roll with the correct root, and with the comment moved a bit. If no-one else complains in the next days, I'll commit it.

drunken monkey’s picture

Status: Needs review » Fixed

Committed.
Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.