I would simply only do:

```{% set apps = this if category else get_featured(this) %}```

And do ```for result in apps```.