{"version":3,"file":"subscription_facade_mixin-Dt4OVOTR.js","sources":["../../../app/javascript/components/quiz/evalmee/subscription_facade_mixin.js"],"sourcesContent":["import { mapGetters } from \"vuex\"\n\n// Don't use this mixin anymore.\n// User useQuizzesSubscription composable instead.\nexport default {\n computed: {\n ...mapGetters([\n \"quizzesSubscriptions\",\n \"schoolsUser\",\n \"scoreByQuizAndUserId\",\n ]),\n subscriptions() {\n const filter =\n this.quiz?.state === \"preview\"\n ? () => true\n : (s) => s.role === \"student\"\n return this.quizzesSubscriptions(this.quiz?.id).filter(filter)\n },\n scoreByUserId() {\n return (userId) => this.scoreByQuizAndUserId(this.quiz?.id, userId)\n },\n statusByUserId() {\n return (userId) => {\n if (!this.scoreByUserId(userId)) return \"not_started\"\n return this.scoreByUserId(userId).state\n }\n },\n subscriptionsFacade() {\n return this.subscriptions.map((subs) => {\n const schoolsUser = this.schoolsUser(subs.schools_user_id)\n const score = this.scoreByUserId(schoolsUser?.user_id)\n return {\n ...subs,\n name: subs?.name,\n lastName: schoolsUser?.last_name,\n email: schoolsUser?.email,\n teacher: schoolsUser?.teacher,\n cheating_attempt_count: score?.cheating_attempt_count,\n teacher_cheat_confirmation: score?.teacher_cheat_confirmation,\n answered_questions_count_cache: score?.answered_questions_count_cache,\n has_score: !!score,\n status: this.statusByUserId(schoolsUser?.user_id),\n user_id: subs?.user_id,\n student_id: schoolsUser?.student_id,\n score,\n }\n })\n },\n },\n}\n"],"names":["subscriptionFacadeMixin","__spreadProps","__spreadValues","mapGetters","filter","_a","s","_b","userId","subs","schoolsUser","score"],"mappings":"s1BAIA,MAAeA,EAAA,CACb,SAAUC,EAAAC,EAAA,GACLC,EAAW,CACZ,uBACA,cACA,sBACN,CAAK,GALO,CAMR,eAAgB,SACd,MAAMC,IACJC,EAAA,KAAK,OAAL,YAAAA,EAAW,SAAU,UACjB,IAAM,GACLC,GAAMA,EAAE,OAAS,UACxB,OAAO,KAAK,sBAAqBC,EAAA,KAAK,OAAL,YAAAA,EAAW,EAAE,EAAE,OAAOH,CAAM,CAC9D,EACD,eAAgB,CACd,OAAQI,GAAM,OAAK,YAAK,sBAAqBH,EAAA,KAAK,OAAL,YAAAA,EAAW,GAAIG,CAAM,EACnE,EACD,gBAAiB,CACf,OAAQA,GACD,KAAK,cAAcA,CAAM,EACvB,KAAK,cAAcA,CAAM,EAAE,MADM,aAG3C,EACD,qBAAsB,CACpB,OAAO,KAAK,cAAc,IAAKC,GAAS,CACtC,MAAMC,EAAc,KAAK,YAAYD,EAAK,eAAe,EACnDE,EAAQ,KAAK,cAAcD,GAAA,YAAAA,EAAa,OAAO,EACrD,OAAOT,EAAAC,EAAA,GACFO,GADE,CAEL,KAAMA,GAAA,YAAAA,EAAM,KACZ,SAAUC,GAAA,YAAAA,EAAa,UACvB,MAAOA,GAAA,YAAAA,EAAa,MACpB,QAASA,GAAA,YAAAA,EAAa,QACtB,uBAAwBC,GAAA,YAAAA,EAAO,uBAC/B,2BAA4BA,GAAA,YAAAA,EAAO,2BACnC,+BAAgCA,GAAA,YAAAA,EAAO,+BACvC,UAAW,CAAC,CAACA,EACb,OAAQ,KAAK,eAAeD,GAAA,YAAAA,EAAa,OAAO,EAChD,QAASD,GAAA,YAAAA,EAAM,QACf,WAAYC,GAAA,YAAAA,EAAa,WACzB,MAAAC,CACV,EACO,CAAA,CACF,CACF,EACH"}