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

Open release/palm.4/edues #786

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c5c35d4
feat: add support to send email to cherry-picked students
mariajgrimaldi Sep 4, 2023
80fec1d
refactor!: remove the hardcoded implementations
mariajgrimaldi Sep 12, 2023
745fbc5
refactor: costume changes according MFE implementation
mariajgrimaldi Sep 12, 2023
8ae2d3f
refactor: remove ora from base requirements
mariajgrimaldi Sep 19, 2023
1342f3a
feat: add instructor dashboard filter integration (#32448)
mariajgrimaldi Sep 7, 2023
77536b6
fix: use correct version for openedx-filters
mariajgrimaldi Oct 19, 2023
4d57bdc
feat: emit signal for thread, response, and comment created event
Ian2012 Oct 2, 2023
8aea54c
chore: reformat views file
Ian2012 Oct 9, 2023
dc3fbdb
test: update query count for cs_comment_client
Ian2012 Oct 9, 2023
3068812
refactor: proper name for event variable
Ian2012 Oct 19, 2023
6147423
feat: /api/ora_staff_grader/initialize upgraded
nandodev-net Oct 16, 2023
48faf7c
feat: generate_assessment_data handler created
nandodev-net Oct 18, 2023
7627666
fix: style and functions rename
nandodev-net Oct 20, 2023
79523de
fix: test submission metadata serializers upgraded
nandodev-net Oct 23, 2023
7cf7b47
fix: style and some test and docs improvements
nandodev-net Oct 25, 2023
daf345a
fix: HTTPStatus conditional
nandodev-net Oct 26, 2023
70bb852
chore: update assessment_filter argument and update docstring
BryanttV Nov 1, 2023
ebc9642
chore: fix quality errors
BryanttV Nov 7, 2023
92caa0b
fix: allow leave open managed teams
Ian2012 Nov 8, 2023
e7a8156
feat: add open_managed team type
Ian2012 Nov 7, 2023
e7cc40e
feat: add grading strategy support
BryanttV Nov 2, 2023
0fb43ee
refactor: add grading strategy handler class
BryanttV Nov 9, 2023
ad52a91
feat: show grading strategy in student view
BryanttV Nov 9, 2023
666930f
fix: reset score history when reset student attempts
BryanttV Nov 9, 2023
0d584dd
fix: add missing argument in handle_average_attempt and fix typing hint
BryanttV Nov 9, 2023
a1327eb
chore: remove inline comments and print statements
BryanttV Nov 16, 2023
441860f
chore: remove inline comments and improve docstring of serializers
BryanttV Nov 14, 2023
9bf131f
refactor: rename assessment_filter to assessment_type
BryanttV Nov 16, 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
2 changes: 1 addition & 1 deletion cms/djangoapps/models/settings/course_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def validate_single_topic(cls, topic_settings):
"""
error_list = []
valid_teamset_types = [TeamsetType.open.value, TeamsetType.public_managed.value,
TeamsetType.private_managed.value]
TeamsetType.private_managed.value, TeamsetType.open_managed.value]
valid_keys = {'id', 'name', 'description', 'max_team_size', 'type'}
teamset_type = topic_settings.get('type', {})
if teamset_type:
Expand Down
3 changes: 2 additions & 1 deletion lms/djangoapps/bulk_email/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class BulkEmailTargetChoices:
SEND_TO_LEARNERS = "learners"
SEND_TO_COHORT = "cohort"
SEND_TO_TRACK = "track"
SEND_TO_INDIVIDUAL_LEARNERS = "individual-learners"

TARGET_CHOICES = (SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK)
TARGET_CHOICES = (SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK, SEND_TO_INDIVIDUAL_LEARNERS)

@classmethod
def is_valid_target(cls, target):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.20 on 2023-09-04 14:11

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('bulk_email', '0007_disabledcourse'),
]

operations = [
migrations.AlterField(
model_name='target',
name='target_type',
field=models.CharField(choices=[('myself', 'Myself'), ('staff', 'Staff and instructors'), ('learners', 'All students'), ('cohort', 'Specific cohort'), ('track', 'Specific course mode'), ('individual-students', 'Specific list of students')], max_length=64),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.20 on 2023-09-12 19:12

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('bulk_email', '0008_alter_target_target_type'),
]

operations = [
migrations.AlterField(
model_name='target',
name='target_type',
field=models.CharField(choices=[('myself', 'Myself'), ('staff', 'Staff and instructors'), ('learners', 'All students'), ('cohort', 'Specific cohort'), ('track', 'Specific course mode'), ('individual-learners', 'Specific list of students')], max_length=64),
),
]
14 changes: 11 additions & 3 deletions lms/djangoapps/bulk_email/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ class Meta:
SEND_TO_LEARNERS = 'learners'
SEND_TO_COHORT = 'cohort'
SEND_TO_TRACK = 'track'
SEND_TO_INDIVIDUAL_LEARNERS = 'individual-learners'
EMAIL_TARGET_CHOICES = list(zip(
[SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK],
['Myself', 'Staff and instructors', 'All students', 'Specific cohort', 'Specific course mode']
[SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK, SEND_TO_INDIVIDUAL_LEARNERS],
['Myself', 'Staff and instructors', 'All students', 'Specific cohort', 'Specific course mode', 'Specific list of students']
))
EMAIL_TARGETS = {target[0] for target in EMAIL_TARGET_CHOICES}

Expand Down Expand Up @@ -106,7 +107,7 @@ def long_display(self):
else:
return self.get_target_type_display()

def get_users(self, course_id, user_id=None):
def get_users(self, course_id, user_id=None, emails=None):
"""
Gets the users for a given target.

Expand Down Expand Up @@ -148,6 +149,13 @@ def get_users(self, course_id, user_id=None):
& enrollment_query
)
)
elif self.target_type == SEND_TO_INDIVIDUAL_LEARNERS:
return use_read_replica_if_available(
User.objects.filter(
models.Q(email__in=emails)
& enrollment_query
)
)
else:
raise ValueError(f"Unrecognized target type {self.target_type}")

Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/bulk_email/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def perform_delegate_email_batches(entry_id, course_id, task_input, action_name)
global_email_context = _get_course_email_context(course)

recipient_qsets = [
target.get_users(course_id, user_id)
target.get_users(course_id, user_id, task_input.get("emails", []))
for target in targets
]
# Use union here to combine the qsets instead of the | operator. This avoids generating an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def inner(self, default_store, block_count, mongo_calls, sql_queries, *args, **k
return inner

@ddt.data(
(ModuleStoreEnum.Type.split, 3, 8, 42),
(ModuleStoreEnum.Type.split, 3, 8, 43),
)
@ddt.unpack
@count_queries
Expand Down
51 changes: 49 additions & 2 deletions lms/djangoapps/discussion/django_comment_client/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@
from django.views.decorators.http import require_GET, require_POST
from eventtracking import tracker
from opaque_keys.edx.keys import CourseKey
from openedx_events.learning.data import DiscussionThreadData, UserData, UserPersonalData
from openedx_events.learning.signals import (
FORUM_RESPONSE_COMMENT_CREATED,
FORUM_THREAD_CREATED,
FORUM_THREAD_RESPONSE_CREATED
)

import lms.djangoapps.discussion.django_comment_client.settings as cc_settings
import openedx.core.djangoapps.django_comment_common.comment_client as cc
from common.djangoapps.student.roles import GlobalStaff
from common.djangoapps.util.file import store_uploaded_file
from common.djangoapps.track import contexts
from common.djangoapps.util.file import store_uploaded_file
from lms.djangoapps.courseware.access import has_access
from lms.djangoapps.courseware.courses import get_course_overview_with_access, get_course_with_access
from lms.djangoapps.courseware.exceptions import CourseAccessRedirect
Expand All @@ -42,7 +48,7 @@
get_user_group_ids,
is_comment_too_deep,
prepare_content,
sanitize_body,
sanitize_body
)
from openedx.core.djangoapps.django_comment_common.signals import (
comment_created,
Expand All @@ -66,6 +72,12 @@
TRACKING_MAX_FORUM_TITLE = 1000
_EVENT_NAME_TEMPLATE = 'edx.forum.{obj_type}.{action_name}'

TRACKING_LOG_TO_EVENT_MAPS = {
'edx.forum.thread.created': FORUM_THREAD_CREATED,
'edx.forum.response.created': FORUM_THREAD_RESPONSE_CREATED,
'edx.forum.comment.created': FORUM_RESPONSE_COMMENT_CREATED,
}


def track_forum_event(request, event_name, course, obj, data, id_map=None):
"""
Expand Down Expand Up @@ -97,6 +109,41 @@ def track_forum_event(request, event_name, course, obj, data, id_map=None):
with tracker.get_tracker().context(event_name, context):
tracker.emit(event_name, data)

forum_event = TRACKING_LOG_TO_EVENT_MAPS.get(event_name, None)
if forum_event is not None:
forum_event.send_event(
thread=DiscussionThreadData(
anonymous=data.get('anonymous'),
anonymous_to_peers=data.get('anonymous_to_peers'),
body=data.get('body'),
category_id=data.get('category_id'),
category_name=data.get('category_name'),
commentable_id=data.get('commentable_id'),
group_id=data.get('group_id'),
id=data.get('id'),
team_id=data.get('team_id'),
thread_type=data.get('thread_type'),
title=data.get('title'),
title_truncated=data.get('title_truncated'),
truncated=data.get('truncated'),
url=data.get('url'),
discussion=data.get('discussion'),
user_course_roles=data.get('user_course_roles'),
user_forums_roles=data.get('user_forums_roles'),
user=UserData(
pii=UserPersonalData(
username=user.username,
email=user.email,
name=user.profile.name,
),
id=user.id,
is_active=user.is_active,
),
course_id=str(course.id),
options=data.get('options'),
)
)


def track_created_event(request, event_name, course, obj, data):
"""
Expand Down
Loading
Loading