Files
sm-bm-plugin/public/assets/quizzes-C4a6BQv2.js
2026-10-02 17:42:16 +02:00

2 lines
1.7 KiB
JavaScript

import{e as p}from"./format-bcE-cYHJ.js";import{d as z,o,c as a,F as c,y as h,a as d,m,t as n,b as _,x as q,e as l,L as r}from"./index-D5YFSKUV.js";const y={class:"rows"},$={class:"row-main"},k={class:"title"},w=["aria-label"],f={key:1,class:"badge"},b={class:"muted small"},S=z({__name:"AttemptList",props:{attempts:{},showQuiz:{type:Boolean}},setup(e){const s=u=>`${Math.round(u.score_points)}/${Math.round(u.max_points)}`;return(u,g)=>(o(),a("ul",y,[(o(!0),a(c,null,h(e.attempts,t=>(o(),a("li",{key:t.id},[d("div",$,[d("span",k,[e.showQuiz?(o(),a(c,{key:0},[m(n(t.quiz_title),1)],64)):(o(),a(c,{key:1},[m(n(_(p)(t.started_at)),1)],64))]),t.completed_at?(o(),a("span",{key:0,class:q(["badge",t.passed?"online":""]),"aria-label":`Wynik ${s(t)}`},n(s(t)),11,w)):(o(),a("span",f,"niezakończona"))]),d("div",b,[e.showQuiz?(o(),a(c,{key:0},[m(n(_(p)(t.started_at))+" · ",1)],64)):l("",!0),t.category?(o(),a(c,{key:1},[m(n(t.category)+" · ",1)],64)):l("",!0),m(" odpowiedzi: "+n(t.answered_count),1),t.completed_at&&t.score_percent!==null?(o(),a(c,{key:2},[m(" · "+n(String(t.score_percent).replace(".",","))+"% puli",1)],64)):l("",!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};