Merge pull request #703 from taigaio/enhancement/featured_project_list_randomly_ordered

Get a randomized list of featured projects if discover mode is enabled
remotes/origin/issue/4795/notification_even_they_are_disabled
Alejandro 2016-04-20 10:49:37 +02:00
commit a992fe2704
2 changed files with 5 additions and 3 deletions

View File

@ -15,12 +15,10 @@
- CSV Reports: - CSV Reports:
- Change field name: 'milestone' to 'sprint' - Change field name: 'milestone' to 'sprint'
- Add new fields: 'sprint_estimated_start' and 'sprint_estimated_end' - Add new fields: 'sprint_estimated_start' and 'sprint_estimated_end'
### Misc
- Add sprint name and slug on search results for user stories ((thanks to [@everblut](https://github.com/everblut))) - Add sprint name and slug on search results for user stories ((thanks to [@everblut](https://github.com/everblut)))
- [API] projects resource: Random order if `discover_mode=true` and `is_featured=true`.
- Lots of small and not so small bugfixes. - Lots of small and not so small bugfixes.
## 2.0.0 Pulsatilla Patens (2016-04-04) ## 2.0.0 Pulsatilla Patens (2016-04-04)
### Features ### Features

View File

@ -40,6 +40,10 @@ class DiscoverModeFilterBackend(FilterBackend):
qs = qs.filter(anon_permissions__contains=["view_project"], qs = qs.filter(anon_permissions__contains=["view_project"],
blocked_code__isnull=True) blocked_code__isnull=True)
# random order for featured projects
if request.QUERY_PARAMS.get("is_featured", None) == 'true':
qs = qs.order_by("?")
return super().filter_queryset(request, qs.distinct(), view) return super().filter_queryset(request, qs.distinct(), view)