PageSourceSearch

https://buildersacademynz.web.app/chunk-6JI5NE5R.js

js buildersacademynz.web.app collected 2026-10-03 12:21:31 UTC 9,332 bytes, 1 lines download raw bytes

1import{a as F}from"./chunk-NFYWOYC5.js";import{F as S,J as M}from"./chunk-3RYB6SVN.js";var A=(()=>{let c=class c{constructor(){this.global=M(F),this.methodStorageKeyPrefix="qualificationProgressMethodByFaculty_",this.studentPageVisibilityOffset=10,this.totalDurationYears=4,this.totalDurationMonths=48,this.defaultDurationMs=this.totalDurationYears*365*24*60*60*1e3,this.expectedCompletionSentinel="2026-07-04 00:00:00",this.theoryCompleteStatuses=new Set(["goal","know","theory complete","completed","employer confirmed"]),this.practicalCompleteStatuses=new Set(["commercially competent","completed","employer confirmed"])}getMethodForFacultySync(e){let t=this.getMethodFromFacultyListSync(e);if(t)return t;let i=this.getMethodStorageKey(e);if(!i)return"unit-count";let r=String(localStorage.getItem(i)||"").trim();return r==="element-weighted"||r==="credit-weighted"||r==="unit-count"||r==="progress-by-year"?r:"unit-count"}setMethodForFacultySync(e,t){let i=this.getMethodStorageKey(e);i&&localStorage.setItem(i,t)}getQualificationProgressVisibleOnStudentPageForFacultySync(e){let t=this.getVisibilityFromFacultyListSync(e);return t!==null?t:!1}methodFromQualCalcValue(e){let t=this.getNormalizedQualCalcMethodValue(e);return t===1?"element-weighted":t===2?"credit-weighted":t===3?"progress-by-year":t===0?"unit-count":null}qualCalcValueFromMethod(e){return e==="element-weighted"?1:e==="credit-weighted"?2:e==="progress-by-year"?3:0}qualCalcValueFromMethodWithStudentPageVisibility(e,t){let i=this.qualCalcValueFromMethod(e);return t?i+this.studentPageVisibilityOffset:i}isQualificationProgressVisibleOnStudentPageFromQualCalcValue(e){let t=Number(e);return Number.isFinite(t)&&t>=this.studentPageVisibilityOffset&&t<=this.studentPageVisibilityOffset+3}calculateFromUnitDataList(e,t,i="unit-count",r){let n=Array.isArray(e)?e:[],s=i==="unit-count"?i:"unit-count",l=n.length,a=s==="unit-count"?n.filter(o=>this.isCompletedUnitStatus(o?.unit?.status)).length:0;return this.buildMetrics(a,l,this.parseStartDate(t),this.parseExpectedCompletionDate(r))}calculateFromQualificationRows(e,t,i="unit-count",r,n){let s=Array.isArray(e)?e:[];if(i==="element-weighted"){let o=0,m=0,d=r??s.find(u=>u?.unit?.faculty!==void 0&&u?.unit?.faculty!==null)?.unit?.faculty,h=this.getSupervisionLevelModeForFacultySync(d),y=h>0||this.hasPracticalSupervisionStatuses(s);return s.forEach(u=>
1{(Array.isArray(u?.element)?u.element:[]).forEach(g=>{o+=1,m+=this.getElementCompletionScore(g,y,h)})}),this.buildMetrics(m,o,this.parseStartDate(t),this.parseExpectedCompletionDate(n))}if(i==="credit-weighted"){let o=0,m=0,d=r??s.find(u=>u?.unit?.faculty!==void 0&&u?.unit?.faculty!==null)?.unit?.faculty,h=this.getSupervisionLevelModeForFacultySync(d),y=h>0||this.hasPracticalSupervisionStatuses(s);return s.forEach(u=>{let p=this.toNumber(u?.unit?.available);if(p<=0)return;o+=p;let g=this.getUnitCompletionRatio(u,y,h);m+=p*g}),this.buildMetrics(m,o,this.parseStartDate(t),this.parseExpectedCompletionDate(n))}let l=s.length,a=s.filter(o=>this.isCompletedUnitStatus(o?.unit?.status)).length;return this.buildMetrics(a,l,this.parseStartDate(t),this.parseExpectedCompletionDate(n))}calculateFromCountEquivalents(e,t,i,r){return this.buildMetrics(e,t,this.parseStartDate(i),this.parseExpectedCompletionDate(r))}buildMetrics(e,t,i,r){let n=this.getPlannedDurationMs(i,r),s=this.getPlannedDurationMonths(n),l=s/12,a=t>0?Math.round(e/t*100):0,o=this.getExpectedCompletionPercentage(i,n),m=t>0&&o!==null?a>=o?"On track":"Behind":null,d=t>0&&o!==null?Math.round(o/100*t):null,h=d!==null?e-d:null,y=o!==null?Math.round((a-o)/100*s):null,u=t>0&&l>0?Number((t/l).toFixed(1)):null,p=this.getActualPacePerYear(i,e);
1return{completionPercentage:a,completedCountEquivalent:e,totalCountEquivalent:t,expectedCompletionPercentage:o,progressStatusText:m,expectedCompletedCountEquivalent:d,unitsGap:h,monthsGap:y,requiredPacePerYear:u,actualPacePerYear:p}}getExpectedCompletionPercentage(e,t){if(!e||t<=0)return null;let r=Math.max(0,new Date().getTime()-e.getTime()),n=Math.min(1,r/t);return Math.round(n*100)}getPlannedDurationMs(e,t){if(!e||!t)return this.defaultDurationMs;let i=t.getTime()-e.getTime();return i<=0?this.defaultDurationMs:i}getPlannedDurationMonths(e){let r=e/(30.416666666666668*864e5);return!Number.isFinite(r)||r<=0?this.totalDurationMonths:r}getActualPacePerYear(e,t){if(!e)return null;let n=Math.max(0,new Date().getTime()-e.getTime())/(365*24*60*60*1e3);return n?Number((t/n).toFixed(1)):null}isCompletedUnitStatus(e){return String(e||"").trim().toLowerCase()==="completed"}isStrictCompletedUnit(e){let t=Array.isArray(e?.element)?e.element:[];return t.length===0?this.isCompletedUnitStatus(e?.unit?.status):t.every(i=>this.isStrictCompletedElement(i))}isStrictCompletedElement(e){let t=String(e?.status||"").trim().toLowerCase();if(!t)return!1;let i=this.getElementModuleType(e);return i===1?this.theoryCompleteStatuses.has(t):i===2?this.practicalCompleteStatuses.has(t):this.theoryCompleteStatuses.has(t)||this.practicalCompleteStatuses.has(t)}getElementCompletionScore(e,t,i){let r=String(e?.status||"").trim().toLowerCase();if(!r)return 0;if(i===0){let l=this.getHiddenSupervisionModeCompletionScore(r);if(l!==null)return l}let n=this.getElementModuleType(e);return n===1?this.theoryCompleteStatuses.has(r)?1:0:n===2?t?r==="supervised"?.25:r==="limited supervision"||r==="limitied supervision"?.5:r==="unsupervised"?.75:r==="commercially competent"||r==="completed"||r==="employer confirmed"?1:0:this.practicalCompleteStatuses.has(r)||r==="completed"?1:0:r==="supervised"||r==="limited supervision"||r==="limitied supervision"||r==="unsupervised"||r==="commercially competent"||r==="completed"||r==="employer confirmed"?t?r==="supervised"?.25:r==="limited supervision"||r==="limitied supervision"?.5:r==="unsupervised"?.75:1:r==="commercially competent"?1:0:this.theoryCompleteStatuses.has(r)||this.practicalCompleteStatuses.has(r)?1:0}getUnitCompletionRatio(e,t,i){let r=Array.isArray(e?.element)?e.element:[];if(r.length===0)return this.isCompletedUnitStatus(e?.unit?.status)?1:0;let s=r.reduce((l,a)=>l+this.getElementCompletionScore(a,t,i),0)/r.length;return!Number.isFinite(s)||s<0?0:s>1?1:s}getHiddenSupervisionModeCompletionScore(e){return e==="completed"?1:e==="student marked as finished"||e==="finished"||e==="employer confirmed"||e==="ready for review"?.75:e==="in progress"?.5:null}getElementModuleType(e){let t=Number(e?.module);if(t===1||t===2)return t;let i=String(e?.module||e?.elementType||"").trim().toLowerCase();if(i==="1"||i==="theory")return 1;if(i==="2"||i==="practical")return 2;let r=String(e?.theory??"").trim().toLowerCase();return r==="1"||r==="true"||r==="theory"?1:r==="0"||r==="false"||r==="practical"?2:null}parseStartDate(e){if(!e)return null;let t=new Date(String(e));return Number.isNaN(t.getTime())?null:t}parseExpectedCompletionDate(e){if(!e)return null;let t=String(e).trim();if(!t||this.isExpectedCompletionSentinel(t))return null;let i=new Date(t);return Number.isNaN(i.getTime())?null:i}isExpectedCompletionSentinel(e){let t=e.replace("T"," ").replace(/\.\d+Z?$/i,"").replace(/Z$/i,"").trim();return t===this.expectedCompletionSentinel||t==="2026-07-04"}toNumber(e){if(e==null||e==="")return 0;let t=Number(e);return Number.isFinite(t)?t:0}getMethodStorageKey(e){let t=String(e??"").trim();return t?`${this.methodStorageKeyPrefix}${t}`:null}getNormalizedQualCalcMethodValue(e){let t=Number(e);return Number.isFinite(t)?t>=this.studentPageVisibilityOffset?t-this.studentPageVisibilityOffset:t:Number.NaN}getMethodFromFacultyListSync(e){let t=String(e??"").trim();if(!t)return null;try{let i=this.getFacultyListRowsSync();if(!Array.isArray(i)||i.length===0)return null;let r=i.find(n=>{let s=String(n?.list_id??"").trim(),l=String(n?.faculty??"").trim();return s===t||l===t});return r?this.methodFromQualCalcValue(r?.qual_calc):null}catch{return null}}getVisibilityFromFacultyListSync(e){let t=String(e??"").trim();if(!t)return null;try{let i=this.getFacultyListRowsSync();if(!Array.isArray(i)||i.length===0)return null;let r=i.find(n=>{let s=String(n?.list_id??"").trim(),l=String(n?.faculty??"").trim();return s===t||l===t});return r?this.isQualificationProgressVisibleOnStudentPageFromQualCalcValue(r?.qual_calc):null}catch{return null}}getSupervisionLevelModeForFacultySync(e){let t=String(e??"").trim();if(!t)return 0;try{let i=this.getFacultyListRowsSync();if(!Array.isArray(i)||i.length===0)return 0;let r=i.find(s=>String(s?.list_id??s?.faculty??"").trim()===t);if(!r)return 0;let n=Number(r?.supervision_level??0);return[0,1,2].includes(n)?n:0}catch{return 0}}hasPracticalSupervisionStatuses(e){return e.some(t=>(Array.isArray(t?.element)?t.element:[]).some(r=>{let n=String(r?.status||"").trim().toLowerCase();return n==="supervised"||n==="limited supervision"||n==="limitied supervision"||n==="unsupervised"||n==="commercially competent"}))}getFacultyListRowsSync(){let e=Array.isArray(this.global.listByFaculty)?this.global.listByFaculty:[];if(e.length>0)return e;try{let t=localStorage.getItem("listByFaculty");if(!t)return[];let i=JSON.parse(t);return Array.isArray(i)?i:Array.isArray(i?.list)?i.list:Array.isArray(i?.data)?i.data:[]}catch{return[]}}};c.\u0275fac=function(t){return new(t||c)},c.\u0275prov=S({token:c,factory:c.\u0275fac,providedIn:"root"});let f=c;return f})();export{A as a};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.