papermaker

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2022 License: MIT Imports: 6 Imported by: 0

README

papermaker

Papermaker is a simple (progressive) web app to help Teachers form exam papers. Built with VueJS, Vant, Go, WASM and docxlib

Building

You will need the following to build:

  • Go 1.18+
  • Task
  • node / npm
  • esbuild
$ task build
# Run also runs the build task, so can use that
$ task run

LICENSE

MIT


Copyright (c) Zikani Nyirenda Mwase

Documentation

Index

Constants

View Source
const (
	FreeFormQuestion        = "free_form"
	LabelTheDiagramQuestion = "label-the-diagram"
	MathematicalQuestion    = "math"
	MultipleChoiceQuestion  = "multiple_choice"
	MixedQuestion           = "mixed"
)
View Source
const MaxFreeFormLines = 4

Variables

This section is empty.

Functions

This section is empty.

Types

type EducationLevel

type EducationLevel string
const (
	Standard1 EducationLevel = "Standard 1"
	Standard2 EducationLevel = "Standard 2"
	Standard3 EducationLevel = "Standard 3"
	Standard4 EducationLevel = "Standard 4"
	Standard5 EducationLevel = "Standard 5"
	Standard6 EducationLevel = "Standard 6"
	Standard7 EducationLevel = "Standard 7"
	Standard8 EducationLevel = "Standard 8"
	Form1     EducationLevel = "Form 1"
	Form2     EducationLevel = "Form 2"
	Form3     EducationLevel = "Form 3"
	Form4     EducationLevel = "Form 4"
	Form5     EducationLevel = "Form 5"
	ALevels   EducationLevel = "A-Levels"
)

type ExamPaper

type ExamPaper struct {
	Title          string         `json:"title"`
	ClassName      EducationLevel `json:"className"`
	SchoolName     string         `json:"schoolName"`
	TeacherName    string         `json:"teacherName"`
	SubjectName    string         `json:"subjectName"`
	TimeAllowed    string         `json:"timeAllowed"`
	ExamDate       string         `json:"examDate"` // TODO: use time.Time
	IsDoubleColumn bool           `json:"isDoubleColumn"`
	Questions      []ExamQuestion `json:"questions"`
}

func (*ExamPaper) TotalMarks

func (p *ExamPaper) TotalMarks() int

TotalMarks calculates the total marks for the Questions

func (*ExamPaper) Validate

func (p *ExamPaper) Validate() ValidationErrors

func (*ExamPaper) WriteDocx

func (p *ExamPaper) WriteDocx(w io.Writer) error

WriteDocx writes the paper as a Docx to an io.Writer

func (*ExamPaper) WriteDocxLib

func (p *ExamPaper) WriteDocxLib(w io.Writer) error

WriteDocx writes the paper as a Docx to an io.Writer

type ExamQuestion

type ExamQuestion struct {
	Section       string                 `json:"section"`
	Title         string                 `json:"title"`
	Content       string                 `json:"content"`
	QuestionType  string                 `json:"questionType"`
	AnswerOptions []MultipleChoiceOption `json:"answerOptions"`
	SortOrder     int                    `json:"sortOrder"`
	Marks         int                    `json:"marks"`
	Image         ImageInfo              `json:"-"`
}

func (*ExamQuestion) WriteDocx

func (q *ExamQuestion) WriteDocx(docxw *gingfrederikdocx.File) error

func (*ExamQuestion) WriteDocxLib

func (q *ExamQuestion) WriteDocxLib(docxw *docxlib.DocxLib) error

type ImageInfo

type ImageInfo struct {
	URL    string `json:"url"`
	Width  string `json:"width"`
	Height string `json:"height"`
	Alt    string `json:"alt"`
}

type MultipleChoiceOption

type MultipleChoiceOption struct {
	Content   string `json:"content"`
	IsCorrect bool   `json:"isCorrect"`
}

type ValidationErrors

type ValidationErrors []string

func (ValidationErrors) ToJSON

func (v ValidationErrors) ToJSON() string

Directories

Path Synopsis
cmd
server command
wasm command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL