Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge release-v0.16.x into develop #11371

Merged
merged 78 commits into from
Oct 8, 2023
Merged
Changes from 7 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
44b92da
Add temporary reference to KDS fork
MisRob Sep 1, 2023
7441007
Add useKShow to apiSpec
MisRob Sep 1, 2023
4080bd6
Fetch lesson sizes before commiting new lessons
MisRob Aug 31, 2023
eca698d
Add loader when toggling lessons
MisRob Sep 1, 2023
2cc02bc
Don't use force deletion when cleaning up resources for content remov…
rtibbles Sep 15, 2023
ecee1be
Tweak which models to exclude from schema generation.
rtibbles Sep 15, 2023
804f581
Set the admin imported flag during resource import.
rtibbles Sep 15, 2023
eb2da96
Clean up admin imported flags, except in content request cleanups.
rtibbles Sep 15, 2023
8338d8b
Decrease time to sync
vkWeb Sep 19, 2023
0243928
Add another field to check on to
vkWeb Sep 19, 2023
0fbacd7
Don't access db
vkWeb Sep 19, 2023
f425a79
Fix outdated test
vkWeb Sep 19, 2023
ab03b39
Rectify update_instance as well with tests
vkWeb Sep 19, 2023
fdd49bd
solved Navigation issue from attached drive
ShivangRawat30 Sep 19, 2023
481c37b
Add tests and a bit clean
vkWeb Sep 25, 2023
8b6cba8
Bump @babel/core from 7.22.20 to 7.23.0
dependabot[bot] Sep 26, 2023
0df01d0
Persist admin_imported flag across channel metadata upgrades.
rtibbles Sep 26, 2023
f9e52d8
Merge pull request #11299 from learningequality/dependabot/npm_and_ya…
rtibbles Sep 26, 2023
d43ab6d
Merge pull request #11271 from vkWeb/time-decrease
bjester Sep 26, 2023
695c078
Add cautionary code comment.
rtibbles Sep 26, 2023
9a3b44e
Merge pull request #11254 from rtibbles/im_an_admin_import_and_im_okay
rtibbles Sep 26, 2023
37a0d19
Bump axios from 1.5.0 to 1.5.1
dependabot[bot] Sep 27, 2023
eb9628b
Bump glob from 10.3.7 to 10.3.9
dependabot[bot] Sep 27, 2023
9f4e579
Bump markdown-it from 13.0.1 to 13.0.2
dependabot[bot] Sep 27, 2023
e1a79f9
Bump autoprefixer from 10.4.15 to 10.4.16
dependabot[bot] Sep 27, 2023
216fb32
Merge branch 'release-v0.16.x' into coach-loading
MisRob Sep 27, 2023
4f5d2d3
Replace temporary fork reference by the latest KDS
MisRob Sep 27, 2023
1bd8914
Merge pull request #11305 from learningequality/dependabot/npm_and_ya…
rtibbles Sep 27, 2023
0d07311
Merge pull request #11307 from learningequality/dependabot/npm_and_ya…
rtibbles Sep 27, 2023
33a7b9d
Merge pull request #11308 from learningequality/dependabot/npm_and_ya…
rtibbles Sep 27, 2023
a86b996
Merge pull request #11309 from learningequality/dependabot/npm_and_ya…
rtibbles Sep 27, 2023
6257a5c
Merge pull request #11201 from MisRob/coach-loading
MisRob Sep 27, 2023
d86a484
Bump glob from 10.3.9 to 10.3.10
dependabot[bot] Sep 28, 2023
d8ecd41
Merge pull request #11312 from learningequality/dependabot/npm_and_ya…
rtibbles Sep 28, 2023
ea1ee36
Fixed the reference for the missing string
radinamatic Sep 28, 2023
601fcd0
No results for not visible lessons
radinamatic Sep 28, 2023
0e0348a
Fixes performance regression. Uses capabilities to properly check if …
rtibbles Sep 28, 2023
c78ab9f
Bump postcss-scss from 4.0.8 to 4.0.9
dependabot[bot] Sep 29, 2023
37f23a8
Merge pull request #11318 from learningequality/dependabot/npm_and_ya…
rtibbles Sep 29, 2023
c12d143
Disabling additional user import until multiple user syncing is working
AllanOXDi Sep 14, 2023
9b355e3
added a route to the loading task page when a single user has been im…
AllanOXDi Sep 15, 2023
4308258
added a TO DO
AllanOXDi Sep 15, 2023
6d35989
routed a user away from the import users page onclicking the import b…
AllanOXDi Sep 22, 2023
6efd729
capitalized TODO text
AllanOXDi Sep 29, 2023
9188e6a
Imrproved naming for readability
radinamatic Sep 29, 2023
48b414d
Merge pull request #11313 from radinamatic/no-results
rtibbles Sep 29, 2023
46b21c0
Merge pull request #11242 from AllanOXDi/prevent_multiple_user_imports
rtibbles Sep 29, 2023
cc8e657
Merge pull request #11317 from rtibbles/we_can_rebuild_it_we_have_the…
marcellamaki Sep 29, 2023
cd42526
Some minor linting fixes that became apparent after linting updates, …
rtibbles Sep 29, 2023
595ff11
bugfix- birth year selction
haldaranup Sep 29, 2023
8d0c638
changed backRoute() in selectConentPage/index.js
ShivangRawat30 Oct 1, 2023
3a7b39d
minor change
ShivangRawat30 Oct 1, 2023
d0e141c
Bump core-js from 3.32.2 to 3.33.0
dependabot[bot] Oct 2, 2023
03bed2b
Merge pull request #11343 from learningequality/dependabot/npm_and_ya…
rtibbles Oct 2, 2023
4f9787c
Merge pull request #11339 from rtibbles/linting_fixes
rtibbles Oct 2, 2023
9b083ec
format
haldaranup Oct 3, 2023
7f5427e
Linting: let to const for date variable
haldaranup Oct 3, 2023
b421175
linting errors fixed
ShivangRawat30 Oct 3, 2023
6251a50
Merge pull request #11337 from haldaranup/bugfix-birth-year-selction
rtibbles Oct 3, 2023
2832114
Pass dummy auth token to testing script.
rtibbles Oct 3, 2023
9b02095
Fix linting.
rtibbles Oct 3, 2023
53e4072
Merge pull request #11272 from ShivangRawat30/11187
rtibbles Oct 3, 2023
b536b58
stub out KCircularLoader in failing test
thanksameeelian Sep 29, 2023
1022ed6
update KDS reference to current HEAD of release-v1.5.x branch
thanksameeelian Oct 3, 2023
a061ef2
Merge pull request #11315 from thanksameeelian/side-panel-opening-aft…
MisRob Oct 4, 2023
6caef65
Merge pull request #11347 from rtibbles/tweak_script
rtibbles Oct 4, 2023
9e1bdc5
Migrates the OSUser associated with a facility user when migrating us…
rtibbles Oct 3, 2023
b11412e
Reference exception properly.
rtibbles Oct 4, 2023
0001015
Merge pull request #11348 from rtibbles/migrate_os_user
rtibbles Oct 4, 2023
1797e14
Deleted the responsiveWindowMixin from user_auth
ShivangRawat30 Oct 5, 2023
bfc0430
Add regression tests to ecosystem tests to ensure that recreated obje…
rtibbles Oct 3, 2023
0bfe2dd
Upgrade morango to 0.6.18.
rtibbles Oct 5, 2023
c509e0e
Bump csv-parse from 5.5.0 to 5.5.1
dependabot[bot] Oct 6, 2023
f7442ef
kolibri-tools: Accept multiple --namespace/--searchPath arguments
pwithnall Sep 22, 2023
5925dda
Merge pull request #11360 from learningequality/dependabot/npm_and_ya…
rtibbles Oct 6, 2023
a5992fb
Merge pull request #11359 from rtibbles/now_you_see_it_now_you_dont
rtibbles Oct 7, 2023
358bb82
Merge pull request #11357 from endlessm/kolibri-tools-more-namespaces
rtibbles Oct 8, 2023
23a5b6e
Merge pull request #11354 from ShivangRawat30/11332
rtibbles Oct 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions kolibri/core/auth/tasks.py
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@
from kolibri.core.tasks.exceptions import JobNotFound
from kolibri.core.tasks.exceptions import UserCancelledError
from kolibri.core.tasks.job import JobStatus
from kolibri.core.tasks.job import Priority
from kolibri.core.tasks.job import State
from kolibri.core.tasks.main import job_storage
from kolibri.core.tasks.permissions import IsAdminForJob
@@ -627,9 +628,7 @@ def stop_request_soud_sync(server, user):
stoppeerusersync(server, user)


@register_task(
queue=soud_sync_queue,
)
@register_task(queue=soud_sync_queue, priority=Priority.HIGH, status_fn=status_fn)
def request_soud_sync(server, user, queue_id=None, ttl=4):
"""
Make a request to the serverurl endpoint to sync this SoUD (Subset of Users Device)
71 changes: 62 additions & 9 deletions kolibri/core/discovery/test/test_network_search.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import mock
from django.test import TransactionTestCase

from ..utils.network.broadcast import KolibriBroadcast
from ..utils.network.broadcast import KolibriInstance
from ..utils.network.search import NetworkLocationListener

from kolibri.core.tasks.job import Priority

MOCK_INTERFACE_IP = "111.222.111.222"
MOCK_PORT = 555
MOCK_ID = "abba"
SEARCH_MODULE = "kolibri.core.discovery.utils.network.search."
DYNAMIC_NETWORK_LOCATION_TASK_PRIORITY_METHOD = (
SEARCH_MODULE
+ "NetworkLocationListener._get_dynamic_network_location_task_priority"
)


class NetworkLocationListenerTestCase(TransactionTestCase):
@@ -24,34 +29,82 @@ def setUp(self):
"instance_id": MOCK_ID,
},
)
self.mock_broadcast = mock.MagicMock(id="abc123")
self.listener = NetworkLocationListener(self.mock_broadcast)
self.broadcast_instance = KolibriInstance(
"abcd",
ip=MOCK_INTERFACE_IP,
port=MOCK_PORT,
device_info={
"instance_id": "abcd",
},
)

self.broadcast = KolibriBroadcast(instance=self.broadcast_instance)
self.broadcast.id = "abc123"

self.listener = NetworkLocationListener(self.broadcast)

@mock.patch(SEARCH_MODULE + "reset_connection_states.enqueue")
def test_register_instance(self, mock_enqueue):
self.listener.register_instance(self.instance)
mock_enqueue.assert_called_once_with(args=(self.mock_broadcast.id,))
mock_enqueue.assert_called_once_with(args=(self.broadcast.id,))

def test_dynamic_network_location_task_priority_self_no_lod(self):
# The current device is not a LOD.
self.broadcast_instance.device_info["subset_of_users_device"] = False

priority = self.listener._get_dynamic_network_location_task_priority(
self.instance
)
self.assertEqual(priority, Priority.HIGH)

def test_dynamic_network_location_task_priority_self_discovered_both_lod(self):
# The current device is a LOD.
self.broadcast_instance.device_info["subset_of_users_device"] = True
# The discovered device is LOD as well.
self.instance.device_info["subset_of_users_device"] = True

priority = self.listener._get_dynamic_network_location_task_priority(
self.instance
)
self.assertEqual(priority, Priority.REGULAR)

def test_dynamic_network_location_task_priority_self_lod_discovered_not_lod(self):
# The current device is a LOD.
self.broadcast_instance.device_info["subset_of_users_device"] = True
# The discovered device is not a LOD.
self.instance.device_info["subset_of_users_device"] = False

priority = self.listener._get_dynamic_network_location_task_priority(
self.instance
)
self.assertEqual(priority, Priority.HIGH)

@mock.patch(SEARCH_MODULE + "add_dynamic_network_location.enqueue")
def test_add_instance(self, mock_enqueue):
@mock.patch(DYNAMIC_NETWORK_LOCATION_TASK_PRIORITY_METHOD)
def test_add_instance(self, mock_priority_method, mock_enqueue):
self.listener.add_instance(self.instance)
mock_priority_method.assert_called_once_with(self.instance)
mock_enqueue.assert_called_once_with(
job_id="9e89d3ea5256721c9cd631eac36feafe",
args=(self.mock_broadcast.id, self.instance.to_dict()),
args=(self.broadcast.id, self.instance.to_dict()),
priority=mock_priority_method(),
)

@mock.patch(SEARCH_MODULE + "add_dynamic_network_location.enqueue")
def test_update_instance(self, mock_enqueue):
@mock.patch(DYNAMIC_NETWORK_LOCATION_TASK_PRIORITY_METHOD)
def test_update_instance(self, mock_priority_method, mock_enqueue):
self.listener.update_instance(self.instance)
mock_priority_method.assert_called_once_with(self.instance)
mock_enqueue.assert_called_once_with(
job_id="9e89d3ea5256721c9cd631eac36feafe",
args=(self.mock_broadcast.id, self.instance.to_dict()),
args=(self.broadcast.id, self.instance.to_dict()),
priority=mock_priority_method(),
)

@mock.patch(SEARCH_MODULE + "remove_dynamic_network_location.enqueue")
def test_remove_instance(self, mock_enqueue):
self.listener.remove_instance(self.instance)
mock_enqueue.assert_called_once_with(
job_id="c5e88d1cb4a342ad3d23081022248fbc",
args=(self.mock_broadcast.id, self.instance.to_dict()),
args=(self.broadcast.id, self.instance.to_dict()),
)
26 changes: 26 additions & 0 deletions kolibri/core/discovery/utils/network/search.py
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
from kolibri.core.discovery.tasks import TYPE_ADD
from kolibri.core.discovery.tasks import TYPE_REMOVE
from kolibri.core.discovery.utils.network.broadcast import KolibriInstanceListener
from kolibri.core.tasks.job import Priority

logger = logging.getLogger(__name__)

@@ -37,13 +38,35 @@ def unregister_instance(self, instance):
# when we stop broadcasting, enqueue task to reset all connection states
reset_connection_states.enqueue(args=(self.broadcast.id,))

def _get_dynamic_network_location_task_priority(self, instance):
priority = Priority.REGULAR
is_current_device_lod = self.broadcast.instance.device_info.get(
"subset_of_users_device", False
)
is_discovered_device_lod = instance.device_info.get(
"subset_of_users_device", False
)

# If the current device is not an LOD,
# OR
# the current device is an LOD and the discovered device is not an LOD,
# then enqueue with high priority.
if (not is_current_device_lod) or (
is_current_device_lod and not is_discovered_device_lod
):
priority = Priority.HIGH
return priority

def add_instance(self, instance):
"""
:type instance: kolibri.core.discovery.utils.network.broadcast.KolibriInstance
"""
priority = self._get_dynamic_network_location_task_priority(instance)

add_dynamic_network_location.enqueue(
job_id=generate_job_id(TYPE_ADD, self.broadcast.id, instance.id),
args=(self.broadcast.id, instance.to_dict()),
priority=priority,
)

def update_instance(self, instance):
@@ -52,9 +75,12 @@ def update_instance(self, instance):
"""
# enqueue as 'add' because update event could fire immediately after 'add', so this dedupes
# the tasks, and it also doesn't do anything differently anyway
priority = self._get_dynamic_network_location_task_priority(instance)

add_dynamic_network_location.enqueue(
job_id=generate_job_id(TYPE_ADD, self.broadcast.id, instance.id),
args=(self.broadcast.id, instance.to_dict()),
priority=priority,
)

def remove_instance(self, instance):