Repository: learningequality/kolibri

Issue:
Coach Reports - change when progress starts being measured in coach reports
## Summary

Implementations team members were confused as to why some exercises were showing up as having progress in Recent but there ended up being no data for it when they clicked into it.

**Suggestion:** 
On coach reports, log that an exercise has been engaged with only when the learner clicked "check answer". 

That way, we avoid having exercises display on the coach's end because of learners who happen to click into an exercise and leave the page without interacting with the exercise.

A potential problem area in the future is overloading the Recent tab with content that has 0 data because of learners who like to click around & explore. 

## System information

 - Version: Kolibri 0.4.0alpha6 http://192.237.248.135:8088/
 - Operating system: Mac
 - Browser: Chrome

## Screenshots

![apr-27-2017 16-46-51](https://cloud.githubusercontent.com/assets/6668144/25508810/7782926e-2b69-11e7-90b5-5ebc6dc3543b.gif)

Exercises should log as "in progress" as soon as there's an interaction with it
## Summary

Marking incorrect answers and getting hints does not log it as "in progress"
The first correct answer on an exercise logs it as "in progress"

## System information

 - Version: Kolibri 0.4.0alpha1.dev915
 - Operating system: MacOS Sierra
 - Browser: Chrome

![apr-27-2017 18-03-18](https://cloud.githubusercontent.com/assets/6668144/25510591/234e5e28-2b76-11e7-966a-3ea42938845b.gif)



Discussion:

Resolving patch:
diff --git a/kolibri/plugins/coach/api.py b/kolibri/plugins/coach/api.py
--- a/kolibri/plugins/coach/api.py
+++ b/kolibri/plugins/coach/api.py
@@ -1,12 +1,13 @@
 import datetime
 from dateutil.parser import parse
 
+from django.db.models import Q
 from django.utils import timezone
 
 from kolibri.auth.constants import role_kinds
 from kolibri.auth.models import Collection, FacilityUser
 from kolibri.content.models import ContentNode
-from kolibri.logger.models import ContentSummaryLog
+from kolibri.logger.models import ContentSummaryLog, MasteryLog
 from rest_framework import pagination, permissions, viewsets
 
 from .serializers import ContentReportSerializer, ContentSummarySerializer, UserReportSerializer
@@ -84,6 +85,7 @@ class RecentReportViewSet(viewsets.ModelViewSet):
     serializer_class = ContentReportSerializer
 
     def get_queryset(self):
+        attempted_mastery_logs = MasteryLog.objects.filter(attemptlogs__isnull=False)
         query_node = ContentNode.objects.get(pk=self.kwargs['content_node_id'])
         if self.request.query_params.get('last_active_time'):
             # Last active time specified
@@ -93,6 +95,7 @@ def get_queryset(self):
         # Set on the kwargs to pass into the serializer
         self.kwargs['last_active_time'] = datetime_cutoff.isoformat()
         recent_content_items = ContentSummaryLog.objects.filter_by_topic(query_node).filter(
+            Q(progress__gt=0) | Q(masterylogs__in=attempted_mastery_logs),
             user__in=get_members_or_user(self.kwargs['collection_kind'], self.kwargs['collection_id']),
             end_timestamp__gte=datetime_cutoff).values_list('content_id')
         return ContentNode.objects.filter(content_id__in=recent_content_items)


Test patch: