internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: learningequality/kolibri

Issue:
Facing error while kolibri 0.12.0 deb file installation
### Observed behavior
After running below command it shows error:
**sudo dpkg -i kolibri_0.12.0b4-0ubuntu1_all.deb**

File downloaded from https://github.com/learningequality/kolibri/releases.

![1](https://user-images.githubusercontent.com/12776071/52693166-f80be700-2f8b-11e9-9711-e9f9fd5e7a47.png)

### Context
Kolibri version : Kolibri 0.12.0
Operating system : Ubuntu 14.04

### Screenshots:
![3](https://user-images.githubusercontent.com/12776071/52693710-7c129e80-2f8d-11e9-970f-aa28a74c4cf0.png)
![2](https://user-images.githubusercontent.com/12776071/52693711-7c129e80-2f8d-11e9-87cc-38b339ab4354.png)



Discussion:
Thanks @swapnil106111 - this is because we have not incremented some version data in the code to reflect that it is a beta. Not sure why it has *only* affected the debian installer though.

Resolving patch:
diff --git a/kolibri/__init__.py b/kolibri/__init__.py
--- a/kolibri/__init__.py
+++ b/kolibri/__init__.py
@@ -15,7 +15,7 @@
 
 #: This may not be the exact version as it's subject to modification with
 #: get_version() - use ``kolibri.__version__`` for the exact version string.
-VERSION = (0, 12, 0, 'alpha', 0)
+VERSION = (0, 12, 0, 'beta', 0)
 
 __author__ = 'Learning Equality'
 __email__ = 'info@learningequality.org'


Test patch:
Repository: learningequality/kolibri

Issue:
inconsistent 'difficult question' reports between learners

### Observed behavior

reported by @jtamiace during last week's bug bash

Clicking a “difficult question” in an exercise does not all show the same question for each learner. Number of learners for a question does not match what the overview says

Question 1 for Jamie and Laura are different:



| Page | Image |
|--|--|
| Question table | ![image](https://user-images.githubusercontent.com/2367265/52676270-7611b480-2ede-11e9-9fb5-7fa116873dde.png)| 
| Jamie's report |  ![image](https://user-images.githubusercontent.com/2367265/52676331-a0637200-2ede-11e9-927b-ec48c065ea05.png) |
| Laura's report | ![image](https://user-images.githubusercontent.com/2367265/52676314-9b062780-2ede-11e9-8926-3b048adc9eec.png)|




### Expected behavior

A 'difficult question' as reported should be consistent

### User-facing consequences

can't effectively use feature 


### Errors and logs
<!--
Relevant logs from:
 * the command line
 * ~/.kolibri/kolibri.log
 * the browser console

Please wrap errors in triple backticks for clean formatting like this:
```
01:10 info: something happened
01:12 error: something bad happened
```
-->

…

### Steps to reproduce
<!--
Precise steps that someone else can follow in order to see this behavior
-->

…

### Context
<!--
Tell us about your environment, including:
 * Kolibri version
 * Operating system
 * Browser
-->

…



Discussion:

Resolving patch:
diff --git a/kolibri/core/logger/api.py b/kolibri/core/logger/api.py
--- a/kolibri/core/logger/api.py
+++ b/kolibri/core/logger/api.py
@@ -170,7 +170,7 @@ def filter_content(self, queryset, name, value):
 
     class Meta:
         model = AttemptLog
-        fields = ['masterylog', 'complete', 'user', 'content']
+        fields = ['masterylog', 'complete', 'user', 'content', 'item']
 
 
 class AttemptLogViewSet(LoggerViewSet):
@@ -197,7 +197,7 @@ def filter_user(self, queryset, name, value):
 
     class Meta:
         model = ExamAttemptLog
-        fields = ['examlog', 'exam', 'user', 'content']
+        fields = ['examlog', 'exam', 'user', 'content', 'item']
 
 
 class ExamAttemptLogViewSet(LoggerViewSet):


Test patch:
Repository: learningequality/kolibri

Issue:
On (at least) one modal, dismissing with enter keypress causes it to come back
### Observed behavior

This was seen with the privacy modal, and is in other places now:

1. Facility > Class Details > Rename Class
1. Privacy link on sign-in page
1. Privacy link on sign-up page
1. Profile page, change password modal
1. "Change" status button for Lessons

It seems to be for the same reasons as #4973 (privacy modal), the "Edit" button maintains focus while the modal is on, so it gets "clicked" again when you dismiss the modal with an Enter keypress.

The common thing between these two cases is that the privacy link and rename use the text-link versions of the Button.

### Expected behavior

Text-type links do not have this side-effect when "clicked" by an enter-keypress

### Context

Kolibri 0.12 latest


Discussion:
> The common thing between these two cases is that the privacy link and rename use the text-link versions of the Button.

iiinteresting

Resolving patch:
diff --git a/kolibri/core/content/signals.py b/kolibri/core/content/signals.py
--- a/kolibri/core/content/signals.py
+++ b/kolibri/core/content/signals.py
@@ -5,6 +5,7 @@
 from .models import ChannelMetadata
 from .models import ContentNode
 from kolibri.core.notifications.models import LearnerProgressNotification
+from kolibri.core.lessons.models import Lesson
 
 
 @receiver(pre_delete, sender=ContentNode)
@@ -22,3 +23,15 @@ def reorder_channels_upon_deletion(sender, instance=None, *args, **kwargs):
     For a given channel, decrement the order of all channels that come after this channel.
     """
     ChannelMetadata.objects.filter(order__gt=instance.order).update(order=F('order') - 1)
+
+
+@receiver(pre_delete, sender=ChannelMetadata)
+def update_lesson_resources_before_delete(sender, instance=None, *args, **kwargs):
+    # Update the resources array of all lessons to ensure they don't have
+    # any deleted content
+    lessons = Lesson.objects.filter(resources__contains=instance.id)
+    for lesson in lessons:
+        updated_resources = [r for r in lesson.resources if r['channel_id'] != instance.id]
+        if len(updated_resources) < len(lesson.resources):
+            lesson.resources = updated_resources
+            lesson.save()


Test patch:
Repository: learningequality/kolibri

Issue:
Class activity is not being recorded - beta11

### Observed behavior

![ubuntu 16 04 3 start running - oracle vm virtualbox_445](https://user-images.githubusercontent.com/1457929/53594141-7bd3ef00-3b9a-11e9-924d-162b65e8a5fa.png)


### Expected behavior
…

### User-facing consequences
…

### Errors and logs
[kolibri.log](https://github.com/learningequality/kolibri/files/2916667/kolibri.log)
[server.log](https://github.com/learningequality/kolibri/files/2916668/server.log)

[Notification DB](https://learningequality.slack.com/files/U0LJG17EK/FGK4N0DRN/notifications.sqlite3)
There should have been several lesson and quiz interactions by user `abbyl` in the last 30 minutes, and more recently quiz interaction by `peterb`


### Steps to reproduce

…

### Context
Version:           0.12.0b11
OS:                Linux-4.4.0-142-generic-x86_64-with-Ubuntu-16.04-xenial
Installer:         apt
Server:            Kolibri internal server

cc @rtibbles @jonboiser @indirectlylit 


Discussion:

Notes so far:

* the `LearnerProgressNotification` table appears to be empty
* on the surface, looks very similar to #5113
* nothing of interest in the logs
still can't reproduce locally. made a PR here with some extra logging: https://github.com/learningequality/kolibri/pull/5221

Resolving patch:
diff --git a/kolibri/core/notifications/apps.py b/kolibri/core/notifications/apps.py
--- a/kolibri/core/notifications/apps.py
+++ b/kolibri/core/notifications/apps.py
@@ -4,13 +4,8 @@
 
 from django.apps import AppConfig
 
-from .tasks import AsyncNotificationsThread
-
 
 class KolibriNotificationsConfig(AppConfig):
     name = 'kolibri.core.notifications'
     label = 'notifications'
     verbose_name = 'Kolibri Notifications'
-
-    def ready(self):
-        AsyncNotificationsThread.start_command()
diff --git a/kolibri/utils/server.py b/kolibri/utils/server.py
--- a/kolibri/utils/server.py
+++ b/kolibri/utils/server.py
@@ -79,6 +79,10 @@ def start(port=8080, run_cherrypy=True):
     # Do a db vacuum periodically
     VacuumThread.start_command()
 
+    from kolibri.core.notifications.tasks import AsyncNotificationsThread
+
+    AsyncNotificationsThread.start_command()
+
     # Write the new PID
     with open(PID_FILE, 'w') as f:
         f.write("%d\n%d" % (os.getpid(), port))


Test patch:
Repository: learningequality/kolibri

Issue:
reminder: remove debug logging code before final release

### Observed behavior

#5223 introduced some verbose logging code

### Expected behavior

remove before release

### User-facing consequences

logs will get swamped

### Errors and logs
<!--
Relevant logs from:
 * the command line
 * ~/.kolibri/kolibri.log
 * the browser console

Please wrap errors in triple backticks for clean formatting like this:
```
01:10 info: something happened
01:12 error: something bad happened
```
-->

…

### Steps to reproduce
<!--
Precise steps that someone else can follow in order to see this behavior
-->

…

### Context
<!--
Tell us about your environment, including:
 * Kolibri version
 * Operating system
 * Browser
-->

…



Discussion:

Resolving patch:
diff --git a/kolibri/core/notifications/tasks.py b/kolibri/core/notifications/tasks.py
--- a/kolibri/core/notifications/tasks.py
+++ b/kolibri/core/notifications/tasks.py
@@ -54,20 +54,15 @@ def run(self):
             with transaction.atomic():
                 for fn in self.running:
                     try:
-                        logging.warn('>>>>>> AsyncNotificationQueue.run try')
                         fn()
                     except Exception as e:
                         # Catch all exceptions and log, otherwise the background process will end
                         # and no more logs will be saved!
-                        logging.warn('>>>>>> AsyncNotificationQueue.run except {}'.format(e))
-                        logging.debug("Exception raised during background notification calculation: ", e)
+                        logging.warn("Exception raised during background notification calculation: ", e)
             connection.close()
 
     def start(self):
         while True:
-            logging.warn('>>>>>> AsyncNotificationQueue.start: {}'.format(threading.currentThread().ident))
-            logging.warn('\t\t len(self.running): {}'.format(self.running))
-            logging.warn('\t\t len(self.queue): {}'.format(self.queue))
             self.toggle_queue()
             self.run()
             self.clear_running()
@@ -91,12 +86,10 @@ class AsyncNotificationsThread(threading.Thread):
 
     @classmethod
     def start_command(cls):
-        logging.warn('>>>>>> AsyncNotificationsThread.start_command: {}'.format(threading.currentThread().ident))
         thread = cls()
         thread.daemon = True
         thread.start()
 
     def run(self):
         logging.info("Initializing background log saving process")
-        logging.warn('>>>>>> AsyncNotificationsThread.run: {}'.format(threading.currentThread().ident))
         log_queue.start()


Test patch:
Repository: learningequality/kolibri

Issue:
block merges when there are sphinx warnings
### Observed behavior

Currently, we allow warnings in our sphinx documentation builds

### Expected behavior

Sphinx warnings should block PR merges as one of the 'status' options

### User-facing consequences

Possible to let broken docs slip through

### Context

* #2958
* #2598
* #2960



Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -94,7 +94,7 @@ def process_docstring(app, what, name, obj, options, lines):
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
+extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode", "m2r"]
 
 linkcheck_ignore = [
     "https://groups.google.com/a/learningequality.org/forum/#!forum/dev"
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@
 
 dist_name = "kolibri"
 
-readme = io.open("README.rst", mode="r", encoding="utf-8").read()
+readme = io.open("README.md", mode="r", encoding="utf-8").read()
 
 # Default description of the distributed package
 description = """Kolibri - the offline app for universal education"""
@@ -137,6 +137,7 @@ def enable_log_to_stdout(logname):
     version=kolibri.__version__,
     description=description,
     long_description=readme,
+    long_description_content_type="text/markdown",
     author="Learning Equality",
     author_email="info@learningequality.org",
     url="https://github.com/learningequality/kolibri",


Test patch:
Repository: learningequality/kolibri

Issue:
Auto sign-out from tablets during normal class
**Observed behavior**
Kids are signout out of their tabs automatically while watching videos or doing quizzes

**Expected behavior**
The user should not be signed out automatically.


**User-facing consequences**
While the kids are in the middle of any exercise or video, they are being automatically signed out. They need to again re-login to continue the session

**Steps to reproduce**
This happens in some of the tabs during a normal classroom session.


**Context**
Kolibri version : Kolibri 0.12.2
Operating system : ubuntu 14.04
Browser : Chrome

![ad5ad6e1-e3cf-497c-a107-e26479a172a2](https://user-images.githubusercontent.com/8583367/56283682-15963200-6130-11e9-99b6-a61d556c359f.jpg)



Discussion:

Resolving patch:
diff --git a/kolibri/core/logger/api.py b/kolibri/core/logger/api.py
--- a/kolibri/core/logger/api.py
+++ b/kolibri/core/logger/api.py
@@ -1,12 +1,17 @@
+import logging
+
 from django.core.exceptions import ObjectDoesNotExist
 from django.db.models.query import F
+from django.db.utils import IntegrityError
 from django.http import Http404
 from django_filters import ModelChoiceFilter
 from django_filters.rest_framework import CharFilter
 from django_filters.rest_framework import DjangoFilterBackend
 from django_filters.rest_framework import FilterSet
 from rest_framework import filters
+from rest_framework import status
 from rest_framework import viewsets
+from rest_framework.exceptions import ValidationError
 from rest_framework.response import Response
 
 from .models import AttemptLog
@@ -36,6 +41,8 @@
 from kolibri.core.content.api import OptionalPageNumberPagination
 from kolibri.core.exams.models import Exam
 
+logger = logging.getLogger(__name__)
+
 
 class BaseLogFilter(FilterSet):
     facility = ModelChoiceFilter(method="filter_facility", queryset=Facility.objects.all())
@@ -90,6 +97,21 @@ def update(self, request, *args, **kwargs):
                 default_response[field] = method(instance)
         return Response(default_response)
 
+    def create(self, request, *args, **kwargs):
+        try:
+            return super(LoggerViewSet, self).create(request, *args, **kwargs)
+        except IntegrityError:
+            # The object has been created previously: let's calculate its id and return it
+            serializer = self.get_serializer(data=request.data)
+            serializer.is_valid(raise_exception=True)
+            obj = serializer.Meta.model(**serializer.validated_data)
+            obj.id = obj.calculate_uuid()
+            final_obj = self.get_serializer(obj)
+            return Response(final_obj.data)
+        except ValidationError as e:
+            logger.error("Failed to validate data: {}".format(e))
+            return Response(request.data, status.HTTP_400_BAD_REQUEST)
+
 
 class ContentSessionLogFilter(BaseLogFilter):
 


Test patch:
Repository: learningequality/kolibri

Issue:
Using Django default CSRFToken can cause confusing behaviour for some system configurations
### Observed behavior
Authentication errors leading to a confusing redirect loop when trying to login.

Fuller report here: https://github.com/iiab/iiab/issues/1532

### Expected behavior
Kolibri users should be able to login.

### User-facing consequences
Hosting Kolibri on the same domain as other Django apps may break functionality.




Discussion:

Resolving patch:
diff --git a/kolibri/deployment/default/settings/base.py b/kolibri/deployment/default/settings/base.py
--- a/kolibri/deployment/default/settings/base.py
+++ b/kolibri/deployment/default/settings/base.py
@@ -261,6 +261,21 @@
 STATIC_URL = urljoin(path_prefix, 'static/')
 STATIC_ROOT = os.path.join(conf.KOLIBRI_HOME, "static")
 
+# https://docs.djangoproject.com/en/1.11/ref/settings/#csrf-cookie-path
+# Ensure that our CSRF cookie does not collide with other CSRF cookies
+# set by other Django apps served from the same domain.
+CSRF_COOKIE_PATH = path_prefix
+
+# https://docs.djangoproject.com/en/1.11/ref/settings/#language-cookie-path
+# Ensure that our language cookie does not collide with other language
+# cookies set by other Django apps served from the same domain.
+LANGUAGE_COOKIE_PATH = path_prefix
+
+# https://docs.djangoproject.com/en/1.11/ref/settings/#session-cookie-path
+# Ensure that our session cookie does not collidge with other session cookies
+# set by other Django apps served from the same domain.
+SESSION_COOKIE_PATH = path_prefix
+
 # https://docs.djangoproject.com/en/1.9/ref/settings/#std:setting-LOGGING
 # https://docs.djangoproject.com/en/1.9/topics/logging/
 


Test patch:
Repository: learningequality/kolibri

Issue:
add support for OIDC in account creation flow

### Observed behavior

currently SSO works for sign in but not account creation

### Expected behavior

the 'next' parameter needs to be passed from the sign in page to the account creation page and handled there

### User-facing consequences

The following flow is not supported:

> 1. User comes to SCE portal and click on login for one server, system would redirect to Kolibri portal.
> 2. On Kolibri portal, user decides to not login but register and clicks on register.
> 3. After registration, user is redirecting to Kolibri portal instead of returning back to SCE portal.



### Context

0.12.5


Discussion:

Resolving patch:
diff --git a/kolibri/core/theme_hook.py b/kolibri/core/theme_hook.py
--- a/kolibri/core/theme_hook.py
+++ b/kolibri/core/theme_hook.py
@@ -42,7 +42,10 @@
 IMG_SRC = "src"
 IMG_STYLE = "style"
 IMG_ALT = "alt"
+SHOW_TITLE = "showTitle"
 SHOW_K_FOOTER_LOGO = "showKolibriFooterLogo"
+SHOW_POWERED_BY = "showPoweredBy"
+POWERED_BY_STYLE = "poweredByStyle"
 
 # This is the image file name that will be used when customizing the sign-in background
 # image using the 'kolibri manage background' command. It does not attempt to use a file
diff --git a/kolibri/plugins/default_theme/kolibri_plugin.py b/kolibri/plugins/default_theme/kolibri_plugin.py
--- a/kolibri/plugins/default_theme/kolibri_plugin.py
+++ b/kolibri/plugins/default_theme/kolibri_plugin.py
@@ -56,6 +56,8 @@ def theme(self):
                     theme_hook.IMG_STYLE: "padding-left: 64px; padding-right: 64px; margin-bottom: 8px; margin-top: 8px",
                     theme_hook.IMG_ALT: None,
                 },
+                theme_hook.SHOW_POWERED_BY: False,
+                theme_hook.SHOW_TITLE: True,
                 theme_hook.SHOW_K_FOOTER_LOGO: False,
             },
             # side-nav config


Test patch:
Repository: learningequality/kolibri

Issue:
update perseus to use new build config scheme

### Observed behavior

follow-up from #5864, need to update perseus to use new buildconfig.  Currently builds but does not run.


### Errors and logs

Currently getting:

```
ERROR    Internal Server Error: /en/user/
Traceback (most recent call last):
  File "/Users/d/Projects/le/kolibri/kolibri/core/webpack/hooks.py", line 111, in _stats_file_content
    with io.open(self._stats_file, mode="r", encoding="utf-8") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/d/Projects/le/kolibri/.venv/lib/python3.7/site-packages/kolibri_exercise_perseus_plugin/build/_stats.json'
```



### Context

current 0.13.0 develop branch



Discussion:

Resolving patch:
diff --git a/packages/kolibri-tools/lib/webpack_json.py b/packages/kolibri-tools/lib/webpack_json.py
--- a/packages/kolibri-tools/lib/webpack_json.py
+++ b/packages/kolibri-tools/lib/webpack_json.py
@@ -15,6 +15,9 @@
 
 logger = logging.getLogger("webpack_json")
 logger.setLevel(level=logging.INFO)
+handler = logging.StreamHandler()
+handler.setLevel(logging.INFO)
+logger.addHandler(handler)
 
 BUILD_CONFIG = "buildConfig.js"
 


Test patch:
diff --git a/packages/kolibri-tools/test/test_webpack.config.base.spec.js b/packages/kolibri-tools/test/test_webpack.config.base.spec.js
--- a/packages/kolibri-tools/test/test_webpack.config.base.spec.js
+++ b/packages/kolibri-tools/test/test_webpack.config.base.spec.js
@@ -16,6 +16,16 @@ jest.mock('../lib/logging', () => ({
   },
 }));
 
+jest.mock(
+  'test',
+  () => ({
+    webpack_config: {
+      entry: 'test',
+    },
+  }),
+  { virtual: true }
+);
+
 const baseData = {
   name: 'kolibri.plugin.test.test_plugin',
   stats_file: 'output.json',
@@ -24,11 +34,8 @@ const baseData = {
   locale_data_folder: 'kolibri/locale/test',
   version: 'test',
   plugin_path: 'kolibri/plugin',
-  config: {
-    entry: {
-      test_plugin: 'src/file.js',
-    },
-  },
+  config_path: 'test',
+  index: null,
 };
 
 describe('webpackConfigBase', function() {
@@ -86,9 +93,9 @@ describe('webpackConfigBase', function() {
       expectParsedDataIsUndefined(data);
     });
   });
-  describe('input is missing config, bundles output', function() {
+  describe('input is missing config_path, bundles output', function() {
     it('should be undefined', function() {
-      delete data.config;
+      delete data.config_path;
       expectParsedDataIsUndefined(data);
     });
   });
Repository: learningequality/kolibri

Issue:
remove stemmed_metaphone field from content nodes

### Observed behavior

The stemmed metaphone field is causing errors, and is not used. Reported from @jeepurs and @rtibbles 

![image](https://user-images.githubusercontent.com/2367265/63297178-a10e0400-c285-11e9-8e27-2041f8ca7942.png)

* this field was added here: https://github.com/learningequality/kolibri/pull/461
* we stopped using it here: https://github.com/learningequality/kolibri/pull/3599

### Expected behavior

Remove the field entirely

### User-facing consequences

errors in console

### Errors and logs

see screenshot above

### Steps to reproduce
<!--
Precise steps that someone else can follow in order to see this behavior
-->

…

### Context

0.12.8



Discussion:
https://sentry.io/organizations/learningequality/issues/1170519046/
https://sentry.io/organizations/learningequality/issues/1170519041/
https://sentry.io/organizations/learningequality/issues/1170456873/
https://sentry.io/organizations/learningequality/issues/1170456872/

causing issues with UN Women online deployments

Resolving patch:
diff --git a/kolibri/core/content/utils/channel_import.py b/kolibri/core/content/utils/channel_import.py
--- a/kolibri/core/content/utils/channel_import.py
+++ b/kolibri/core/content/utils/channel_import.py
@@ -94,6 +94,9 @@ class ChannelImport(object):
             "per_row": {
                 "tree_id": "available_tree_id",
                 "available": "default_to_not_available",
+                # Do this for now because we can't currently delete columns
+                # and properly regenerate our import schema.
+                "stemmed_metaphone": "set_blank_text",
             }
         },
         LocalFile: {"per_row": {"available": "default_to_not_available"}},
@@ -131,6 +134,8 @@ def __init__(self, channel_id, channel_version=None, cancel_check=None):
 
         self.default_to_not_available = 0
 
+        self.set_blank_text = ""
+
     def get_none(self, source_object):
         return None
 
@@ -618,6 +623,7 @@ class NoVersionChannelImport(ChannelImport):
                 "available": "get_none",
                 "license_name": "get_license_name",
                 "license_description": "get_license_description",
+                "stemmed_metaphone": "set_blank_text",
             }
         },
         File: {


Test patch: