chore: moar _ids + id -> _id fix
This commit is contained in:
parent
c96472dbe6
commit
ae4f4d2611
|
|
@ -27,7 +27,8 @@ class PresenceRecordStatisticsType(graphene.ObjectType):
|
||||||
details_url = graphene.String(required=True)
|
details_url = graphene.String(required=True)
|
||||||
|
|
||||||
|
|
||||||
class AttendanceDayPresences(graphene.ObjectType):
|
class AttendanceDayPresencesStatisticsType(graphene.ObjectType):
|
||||||
|
_id = graphene.ID(required=True)
|
||||||
records = graphene.List(PresenceRecordStatisticsType, required=True)
|
records = graphene.List(PresenceRecordStatisticsType, required=True)
|
||||||
summary = graphene.Field(AttendanceSummaryStatisticsType, required=True)
|
summary = graphene.Field(AttendanceSummaryStatisticsType, required=True)
|
||||||
|
|
||||||
|
|
@ -35,7 +36,7 @@ class AttendanceDayPresences(graphene.ObjectType):
|
||||||
def attendance_day_presences(
|
def attendance_day_presences(
|
||||||
course_id: graphene.ID,
|
course_id: graphene.ID,
|
||||||
course_session_selection_ids: graphene.List(graphene.ID),
|
course_session_selection_ids: graphene.List(graphene.ID),
|
||||||
) -> AttendanceDayPresences:
|
) -> AttendanceDayPresencesStatisticsType:
|
||||||
completed = CourseSessionAttendanceCourse.objects.filter(
|
completed = CourseSessionAttendanceCourse.objects.filter(
|
||||||
course_session_id__in=course_session_selection_ids,
|
course_session_id__in=course_session_selection_ids,
|
||||||
due_date__end__lt=timezone.now(),
|
due_date__end__lt=timezone.now(),
|
||||||
|
|
@ -81,7 +82,9 @@ def attendance_day_presences(
|
||||||
participants_present=calculate_avg_participation(records), # noqa
|
participants_present=calculate_avg_participation(records), # noqa
|
||||||
)
|
)
|
||||||
|
|
||||||
return AttendanceDayPresences(summary=summary, records=records) # noqa
|
return AttendanceDayPresencesStatisticsType(
|
||||||
|
summary=summary, records=records, _id=course_id # noqa
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def calculate_avg_participation(records: List[PresenceRecordStatisticsType]) -> float:
|
def calculate_avg_participation(records: List[PresenceRecordStatisticsType]) -> float:
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from vbv_lernwelt.dashboard.graphql.types.assignment import (
|
||||||
)
|
)
|
||||||
from vbv_lernwelt.dashboard.graphql.types.attendance import (
|
from vbv_lernwelt.dashboard.graphql.types.attendance import (
|
||||||
attendance_day_presences,
|
attendance_day_presences,
|
||||||
AttendanceDayPresences,
|
AttendanceDayPresencesStatisticsType,
|
||||||
)
|
)
|
||||||
from vbv_lernwelt.dashboard.graphql.types.competence import (
|
from vbv_lernwelt.dashboard.graphql.types.competence import (
|
||||||
CompetencePerformanceStatisticsSummaryType,
|
CompetencePerformanceStatisticsSummaryType,
|
||||||
|
|
@ -17,7 +17,7 @@ from vbv_lernwelt.dashboard.graphql.types.competence import (
|
||||||
)
|
)
|
||||||
from vbv_lernwelt.dashboard.graphql.types.feedback import (
|
from vbv_lernwelt.dashboard.graphql.types.feedback import (
|
||||||
feedback_responses,
|
feedback_responses,
|
||||||
FeedbackResponses,
|
FeedbackStatisticsResponsesType,
|
||||||
)
|
)
|
||||||
from vbv_lernwelt.learnpath.models import Circle
|
from vbv_lernwelt.learnpath.models import Circle
|
||||||
|
|
||||||
|
|
@ -96,20 +96,25 @@ class CourseStatisticsType(graphene.ObjectType):
|
||||||
course_session_selection_metrics = graphene.Field(
|
course_session_selection_metrics = graphene.Field(
|
||||||
StatisticsCourseSessionsSelectionMetricType, required=True
|
StatisticsCourseSessionsSelectionMetricType, required=True
|
||||||
)
|
)
|
||||||
attendance_day_presences = graphene.Field(AttendanceDayPresences, required=True)
|
attendance_day_presences = graphene.Field(
|
||||||
feedback_responses = graphene.Field(FeedbackResponses, required=True)
|
AttendanceDayPresencesStatisticsType, required=True
|
||||||
|
)
|
||||||
|
feedback_responses = graphene.Field(FeedbackStatisticsResponsesType, required=True)
|
||||||
assignments = graphene.Field(AssignmentsStatisticsType, required=True)
|
assignments = graphene.Field(AssignmentsStatisticsType, required=True)
|
||||||
competences = graphene.Field(CompetencesStatisticsType, required=True)
|
competences = graphene.Field(CompetencesStatisticsType, required=True)
|
||||||
|
|
||||||
def resolve_attendance_day_presences(root, info) -> AttendanceDayPresences:
|
def resolve_attendance_day_presences(
|
||||||
|
root, info
|
||||||
|
) -> AttendanceDayPresencesStatisticsType:
|
||||||
return attendance_day_presences(
|
return attendance_day_presences(
|
||||||
course_id=root.course_id,
|
course_id=root.course_id,
|
||||||
course_session_selection_ids=root.course_session_selection_ids,
|
course_session_selection_ids=root.course_session_selection_ids,
|
||||||
)
|
)
|
||||||
|
|
||||||
def resolve_feedback_responses(root, info) -> FeedbackResponses:
|
def resolve_feedback_responses(root, info) -> FeedbackStatisticsResponsesType:
|
||||||
return feedback_responses(
|
return feedback_responses(
|
||||||
course_session_selection_ids=root.course_session_selection_ids,
|
course_session_selection_ids=root.course_session_selection_ids,
|
||||||
|
course_id=root.course_id,
|
||||||
course_slug=root.course_slug,
|
course_slug=root.course_slug,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -210,7 +215,7 @@ class CourseStatisticsType(graphene.ObjectType):
|
||||||
)
|
)
|
||||||
|
|
||||||
return StatisticsCourseSessionPropertiesType(
|
return StatisticsCourseSessionPropertiesType(
|
||||||
_id=root.id, # noqa
|
_id=root._id, # noqa
|
||||||
sessions=course_session_data, # noqa
|
sessions=course_session_data, # noqa
|
||||||
generations=list(generations), # noqa
|
generations=list(generations), # noqa
|
||||||
circles=circle_data, # noqa
|
circles=circle_data, # noqa
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,15 @@ from vbv_lernwelt.feedback.models import FeedbackResponse
|
||||||
from vbv_lernwelt.feedback.utils import feedback_users
|
from vbv_lernwelt.feedback.utils import feedback_users
|
||||||
|
|
||||||
|
|
||||||
class FeedbackSummary(graphene.ObjectType):
|
class FeedbackStatisticsSummaryType(graphene.ObjectType):
|
||||||
|
_id = graphene.ID(required=True)
|
||||||
satisfaction_average = graphene.Float(required=True)
|
satisfaction_average = graphene.Float(required=True)
|
||||||
satisfaction_max = graphene.Int(required=True)
|
satisfaction_max = graphene.Int(required=True)
|
||||||
total_responses = graphene.Int(required=True)
|
total_responses = graphene.Int(required=True)
|
||||||
|
|
||||||
|
|
||||||
class FeedbackRecord(graphene.ObjectType):
|
class FeedbackStatisticsRecordType(graphene.ObjectType):
|
||||||
|
_id = graphene.ID(required=True)
|
||||||
course_session_id = graphene.ID(required=True)
|
course_session_id = graphene.ID(required=True)
|
||||||
generation = graphene.String(required=True)
|
generation = graphene.String(required=True)
|
||||||
circle_id = graphene.ID(required=True)
|
circle_id = graphene.ID(required=True)
|
||||||
|
|
@ -22,15 +24,17 @@ class FeedbackRecord(graphene.ObjectType):
|
||||||
details_url = graphene.String(required=True)
|
details_url = graphene.String(required=True)
|
||||||
|
|
||||||
|
|
||||||
class FeedbackResponses(graphene.ObjectType):
|
class FeedbackStatisticsResponsesType(graphene.ObjectType):
|
||||||
records = graphene.List(FeedbackRecord, required=True)
|
_id = graphene.ID(required=True)
|
||||||
summary = graphene.Field(FeedbackSummary, required=True)
|
records = graphene.List(FeedbackStatisticsRecordType, required=True)
|
||||||
|
summary = graphene.Field(FeedbackStatisticsSummaryType, required=True)
|
||||||
|
|
||||||
|
|
||||||
def feedback_responses(
|
def feedback_responses(
|
||||||
course_session_selection_ids: graphene.List(graphene.ID),
|
course_session_selection_ids: graphene.List(graphene.ID),
|
||||||
|
course_id: graphene.ID,
|
||||||
course_slug: graphene.String,
|
course_slug: graphene.String,
|
||||||
) -> FeedbackResponses:
|
) -> FeedbackStatisticsResponsesType:
|
||||||
# Get all course sessions for this user in the given course
|
# Get all course sessions for this user in the given course
|
||||||
course_sessions = CourseSession.objects.filter(
|
course_sessions = CourseSession.objects.filter(
|
||||||
id__in=course_session_selection_ids,
|
id__in=course_session_selection_ids,
|
||||||
|
|
@ -58,9 +62,11 @@ def feedback_responses(
|
||||||
circle_feedbacks
|
circle_feedbacks
|
||||||
)
|
)
|
||||||
|
|
||||||
return FeedbackResponses(
|
return FeedbackStatisticsResponsesType(
|
||||||
|
_id=course_id, # noqa
|
||||||
records=circle_feedbacks, # noqa
|
records=circle_feedbacks, # noqa
|
||||||
summary=FeedbackSummary( # noqa
|
summary=FeedbackStatisticsSummaryType( # noqa
|
||||||
|
_id=course_id, # noqa
|
||||||
satisfaction_average=avg, # noqa
|
satisfaction_average=avg, # noqa
|
||||||
satisfaction_max=4, # noqa
|
satisfaction_max=4, # noqa
|
||||||
total_responses=len(fbs), # noqa
|
total_responses=len(fbs), # noqa
|
||||||
|
|
@ -93,7 +99,8 @@ def circle_feedback_average(
|
||||||
for circle_id, data in circle_data.items():
|
for circle_id, data in circle_data.items():
|
||||||
details_url = f"/course/{course_slug}/cockpit/feedback/{circle_id}?courseSessionId={course_session_id}"
|
details_url = f"/course/{course_slug}/cockpit/feedback/{circle_id}?courseSessionId={course_session_id}"
|
||||||
records.append(
|
records.append(
|
||||||
FeedbackRecord(
|
FeedbackStatisticsRecordType(
|
||||||
|
_id=circle_id, # noqa
|
||||||
course_session_id=course_session_id, # noqa
|
course_session_id=course_session_id, # noqa
|
||||||
generation=generation, # noqa
|
generation=generation, # noqa
|
||||||
circle_id=circle_id, # noqa
|
circle_id=circle_id, # noqa
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue