2 lines
1.6 KiB
JavaScript
2 lines
1.6 KiB
JavaScript
import{d as z,n as a,c as o,F as c,E as h,b as l,p as u,t as n,e as p,a8 as _,C as q,f as m,b0 as r}from"./index-BQ0OOvD0.js";const y={class:"rows"},$={class:"row-main"},k={class:"title"},w=["aria-label"],b={key:1,class:"badge"},f={class:"muted small"},S=z({__name:"AttemptList",props:{attempts:{},showQuiz:{type:Boolean}},setup(e){const s=d=>`${Math.round(d.score_points)}/${Math.round(d.max_points)}`;return(d,g)=>(a(),o("ul",y,[(a(!0),o(c,null,h(e.attempts,t=>(a(),o("li",{key:t.id},[l("div",$,[l("span",k,[e.showQuiz?(a(),o(c,{key:0},[u(n(t.quiz_title),1)],64)):(a(),o(c,{key:1},[u(n(p(_)(t.started_at)),1)],64))]),t.completed_at?(a(),o("span",{key:0,class:q(["badge",t.passed?"online":""]),"aria-label":`Wynik ${s(t)}`},n(s(t)),11,w)):(a(),o("span",b,"niezakończona"))]),l("div",f,[e.showQuiz?(a(),o(c,{key:0},[u(n(p(_)(t.started_at))+" · ",1)],64)):m("",!0),t.category?(a(),o(c,{key:1},[u(n(t.category)+" · ",1)],64)):m("",!0),u(" odpowiedzi: "+n(t.answered_count),1),t.completed_at&&t.score_percent!==null?(a(),o(c,{key:2},[u(" · "+n(String(t.score_percent).replace(".",","))+"% puli",1)],64)):m("",!0)])]))),128))]))}}),i="/_quizzes/api/v1",T={list:e=>r.request(`${i}/quizzes`,{query:{context:e}}),quiz:(e,s)=>r.request(`${i}/quizzes/${encodeURIComponent(e)}`,{query:{category:s}}),start:(e,s)=>r.request(`${i}/quizzes/${encodeURIComponent(e)}/attempts`,{method:"POST",body:s?{category:s}:{}}),answer:(e,s)=>r.request(`${i}/attempts/${e}/answers`,{method:"POST",body:s}),finish:e=>r.request(`${i}/attempts/${e}/finish`,{method:"POST"}),attempt:e=>r.request(`${i}/attempts/${e}`),attempts:(e,s)=>r.raw(`${i}/attempts`,{query:{quiz:e,page:s}})};export{S as _,T as q};
|