Notable Customizations - DoSomething/legacy-website GitHub Wiki

Custom work done for Reportback functionality

The view for the "Reviewed" tab for Reportbacks has a customization for the "Total reportback quantity" number.

  • View url: /admin/structure/views/view/reportback_files/edit/page_1
  • Page url: Path:/node/%/rb/reviewed, where % is the nid of the campaign

The view page has additional markup added via dosomething_reportback_views_pre_render() in dosomething_reportback.module. This hook adds the following markup for total reportback quantity number to the $view->attachment_before property:

<div class="attachment attachment-before">
  <h2> Total reportback quantity: 530</h2>
</div>

The quantity is fetched via dosomething_reportback_get_reportback_total_plus_override(). This function returns the total number of reportbacks with an override added to it. The number fetched for the total comes from a variable called sum_rb_quantity, which is stored in a custom table called dosomething_helpers_variable. Note that this total excludes non-reviewed / flagged reportbacks. The override comes from a custom variable called sum_rb_quantity_override, which is also stored in the dosomething_helpers_variable table.

When a reportback quantity is updated / new reportback is added & reviewed, you will notice that the total reportback quantity for the campaign does not immediately change. It will also not update after clearing the drush cache. There are some technical complications around why the variable is not updated immediately and is not updated on cache clear.

The two variables sum_rb_quantity sum_rb_quantity_override get updated on cron runs (see: dosomething_reportback.cron.inc().

⚠️ **GitHub.com Fallback** ⚠️