"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[96190],{96190:(e,r,n)=>{n.r(r),n.d(r,{AddonModWorkshopAssessmentStrategyAccumulativeHandler:()=>c,AddonModWorkshopAssessmentStrategyAccumulativeHandlerLazyService:()=>i});var t=n(10467),s=n(97383),a=n(79555),o=n(78939),d=n(54438);let i=(()=>{var e;class AddonModWorkshopAssessmentStrategyAccumulativeHandlerLazyService extends o.f{getComponent(){return(0,t.A)((function*(){const{AddonModWorkshopAssessmentStrategyAccumulativeComponent:e}=yield Promise.all([n.e(72076),n.e(89535)]).then(n.bind(n,89535));return e}))()}getOriginalValues(e){return(0,t.A)((function*(){const r=a.HT.instant("core.choosedots"),n=[],t=[];return e.fields.forEach(((o,d)=>{o.dimtitle=a.HT.instant("addon.mod_workshop_assessment_accumulative.dimensionnumber",{$a:o.number}),e.current[d]||(e.current[d]={}),n[d]={},n[d].peercomment=e.current[d].peercomment||"",n[d].number=o.number,e.current[d].grade=e.current[d].grade?parseInt(String(e.current[d].grade),10):-1;const i=parseInt(String(o.grade),10),c=e.dimensionsinfo.find((e=>e.id==parseInt(o.dimensionid,10)));t.push(s.CoreGradesHelper.makeGradesMenu(i,void 0,r,-1,c&&i<0?c.scale:void 0).then((r=>{o.grades=r,n[d].grade=e.current[d].grade})))})),yield Promise.all(t),n}))()}hasDataChanged(e,r){for(const n in e){if(e[n].grade!=r[n].grade)return!0;if(e[n].peercomment!=r[n].peercomment)return!0}return!1}prepareAssessmentData(e,r){return(0,t.A)((function*(){const n={},t={};let s=!1;if(r.fields.forEach(((o,d)=>{if(d<r.dimenssionscount){var i;const c=parseInt(String(e[d].grade),10);!isNaN(c)&&c>=0?n[`grade__idx_${d}`]=c:(t[`grade_${d}`]=a.HT.instant("addon.mod_workshop_assessment_accumulative.mustchoosegrade"),s=!0),n[`peercomment__idx_${d}`]=null!==(i=e[d].peercomment)&&void 0!==i?i:"",n[`gradeid__idx_${d}`]=parseInt(r.current[d].gradeid,10)||0,n[`dimensionid__idx_${d}`]=parseInt(o.dimensionid,10),n[`weight__idx_${d}`]=parseInt(o.weight,10)||0}})),s)throw t;return n}))()}}return(e=AddonModWorkshopAssessmentStrategyAccumulativeHandlerLazyService).ɵfac=(()=>{let r;return function AddonModWorkshopAssessmentStrategyAccumulativeHandlerLazyService_Factory(n){return(r||(r=d.xGo(e)))(n||e)}})(),e.ɵprov=d.jDH({token:e,factory:e.ɵfac,providedIn:"root"}),AddonModWorkshopAssessmentStrategyAccumulativeHandlerLazyService})();const c=(0,a.Qd)(i)}}]);