Open StlMaris123 opened 7 years ago
I added a debugger to the show action for the tags controller and walked through the steps in the following lines
debugger
if params[:id][-1..-1] == "*" # wildcard tags
@wildcard = true
@tags = Tag.where('name LIKE (?)', params[:id][0..-2] + '%')
nodes = Node.where(status: 1, type: node_type)
.includes(:drupal_node_revision, :tag)
.where('term_data.name LIKE (?) OR term_data.parent LIKE (?)', params[:id][0..-2] + '%', params[:id][0..-2] + '%')
.page(params[:page])
.order("node_revisions.timestamp DESC")
else
........
The wildcard was being set to true as expected and @tags returned were '.....' I then decided to call the chained methods one by one to see what they get from the database
(byebug) DrupalNode.where(status: 1, type: node_type).count
=> 7
Then on calling the next chained where method it still returns a count of 7
(byebug) DrupalNode.where(status: 1, type: node_type).includes(:drupal_node_revision, :tag).count
=> 7
Now, including the third chainded where
method returns 0 items
(byebug) DrupalNode.where(status: 1, type: node_type).includes(:drupal_node_revision, :tag).where('term_data.name LIKE (?) OR term_data.parent LIKE (?)', params[:id][0..-2] + '%', params[:id][0..-2] + '%').count
=> 0
``
All users are receiving an email once an assignment is availed. The cohorts should be well defined so that only the targeted cohort receives an email.