Repository: learningequality/kolibri

Issue:
Exam page has lag when I creating an exam
<!--
Instructions:
 * Fill out the sections below, replace …'s with information about your issue
 * Use the 'preview' function above this text box to verify formatting before submitting
-->

### Observed behavior
I observed the exam page was lag when I click the checkbox. When I click Stop it, theirs error message in console. 
Refer to Gherkin scenarios :
https://github.com/learningequality/kolibri/blob/gherkin-features/integration_testing/features/coach/coach-create-exams.feature
![lag-error](https://user-images.githubusercontent.com/38421180/44073483-f9afd3ec-9f48-11e8-9762-1e725ec912c6.png)

![error-msg](https://user-images.githubusercontent.com/38421180/44073489-ff5c4cda-9f48-11e8-9eb5-09d79316c194.png)

<!--
Description of the behavior that was observed, including screenshots or other references when applicable
-->

### Expected behavior
<!--
Description of what behavior was expected but did not occur
-->
no lag when clicking the checkbox.

### Errors and logs
```
Error: Script terminated by timeout at:
get@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:6674
exerciseIsSelected/<@http://127.0.0.1:8080/static/coach_module/coach_module-0.11.0a5.js:1:61791
exerciseIsSelected@http://127.0.0.1:8080/static/coach_module/coach_module-0.11.0a5.js:1:61751
allExercisesWithinTopicSelected@http://127.0.0.1:8080/static/coach_module/coach_module-0.11.0a5.js:1:61374
kolibriGlobal</</Le.prototype.get@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:15849
kolibriGlobal</</Le.prototype.evaluate@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:17006
$e/<@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:18899
$e<@http://127.0.0.1:8080/static/coach_module/coach_module-0.11.0a5.js:1:62248
kolibriGlobal</</</t.prototype._render@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:32600
kolibriGlobal</</fn.prototype.$mount/</<@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:60780
kolibriGlobal</</Le.prototype.get@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:15849
kolibriGlobal</</Le.prototype.run@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:16740
Ae@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:14878
Zt/<@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:11350
Wt@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:7:10852
kolibriGlobal</t.exports@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:91:13652
@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:91:10695
y@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:91:10553
b@http://127.0.0.1:8080/static/default_frontend/default_frontend-0.11.0a5.js:91:10573
default_frontend-0.11.
```
<!--
Relevant logs from:
 * the command line
 * ~/.kolibri/kolibri.log
 * the browser console

Please wrap errors in triple backticks for clean formatting like this:

-->


### Context
<!--
Tell us about your environment, including:
 * Kolibri version
 * Operating system
 * Browser
-->
Kolibri 0.11.0a5
windows 7 (64-bit)
Firefox 61.0.2 (64-bit)



Discussion:
work-arounds based on meeting today with @khangmach @rtibbles @jtamiace 

* hide checkboxes at channel level
* make topics and channel text into purple links
* completely hide rows that are currently disabled

Longer-term (e.g. 0.11.0) we may want to also add validation which shows a modal warning if more than e.g. 200 exercises are selected

Resolving patch:
diff --git a/kolibri/content/api.py b/kolibri/content/api.py
--- a/kolibri/content/api.py
+++ b/kolibri/content/api.py
@@ -54,6 +54,7 @@ def filter_has_exercise(self, queryset, name, value):
 
         for channel in queryset:
             channel_has_exercise = channel.root.get_descendants() \
+                .filter(available=True) \
                 .filter(kind=content_kinds.EXERCISE) \
                 .exists()
             if channel_has_exercise:


Test patch: