Fixed #15624 -- Added aggregate to aggregate_select_mask if mask is set

Patch for [15624](https://code.djangoproject.com/ticket/15624)