schedules

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BLOCKINTERVAL = 30

BLOCKINTERVAL the interval in minutes between each block.

View Source
const HOUR = 60

HOUR minutes whithin an hour.

View Source
const WEEKDAYS = 7

WEEKDAYS number of days in a week.

View Source
const WORKDAYS = 6

WORKDAYS number of days that can have lessons.

Variables

View Source
var DaysEN = [...]string{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}

DaysEN array with the name of the weekdays starting at monday (english).

View Source
var DaysPT = [...]string{"Seg", "Ter", "Qua", "Qui", "Sex", "Sab", "Dom"}

DaysPT array with the name of the weekdays starting at monday (portuguese).

Functions

func DayIntToStr

func DayIntToStr(d int) string

DayIntToStr returns the corresponding string to a numerical day (0 -> Seg, 1 -> Ter, etc.).

func DayStrToInt

func DayStrToInt(s string) int

DayStrToInt returns the numerical representation of a weekday (Seg -> 0, Ter -> 1, etc.).

Types

type CurricularUnit

type CurricularUnit struct {
	Name string `json:"name"`

	Shifts map[string][]*Shift `json:"shifts"`
	// contains filtered or unexported fields
}

CurricularUnit represents a Curricular Unit(CU).

func NewCU

func NewCU(url string) *CurricularUnit

NewCU initializes a CU, returning its address. Utilizes goquery to scrape the CU page's relevant information.

func (*CurricularUnit) AddShift

func (cu *CurricularUnit) AddShift(s *Shift)

AddShift adds a shift to the CU if it is not registered yet.

func (*CurricularUnit) String

func (cu *CurricularUnit) String() string

String representation of a CU.

type Date

type Date struct {
	DayInt int   `json:"day"`
	Start  *Hour `json:"start"`
	End    *Hour `json:"end"`
	// contains filtered or unexported fields
}

Date represents a date. A Date has a weekday and a period of hours.

func NewDate

func NewDate(dateStr string) *Date

NewDate initializes a date with a string similar to "Seg, 11:00 — 12:30" and returns its address.

func (*Date) String

func (d *Date) String() string

String representation of a Date.

type Hour

type Hour struct {
	HourStr string `json:"time"`
	// contains filtered or unexported fields
}

Hour represents an hour (HH:MM).

func NewHour

func NewHour(s string) *Hour

NewHour initializes an Hour from a "HH:MM" string and returns its address.

func (*Hour) String

func (h *Hour) String() string

String representation of an Hour.

type Lesson

type Lesson struct {
	Date *Date `json:"date"`
	// contains filtered or unexported fields
}

Lesson represents a lesson.

func NewLesson

func NewLesson(s *Shift, d *Date) *Lesson

NewLesson initializes a Lesson and returns its address.

func (*Lesson) String

func (l *Lesson) String() string

Representacao em string de uma aula. String representation of a Lesson.

type Schedule

type Schedule struct {
	// contains filtered or unexported fields
}

Schedule represents a schedule. Has shifts and their respective lessons.

func NewSchedule

func NewSchedule() *Schedule

NewSchedule initializes a schedule and returns its address.

func (*Schedule) AddShift

func (sc *Schedule) AddShift(s *Shift)

AddShift appends a shift to the schedule.

func (*Schedule) String

func (sc *Schedule) String() string

String representation of a schedule.

type Shift

type Shift struct {
	Name    string    `json:"name"`
	Type    string    `json:"type"`
	Classes []string  `json:"classes"`
	Lessons []*Lesson `json:"lessons"`
	// contains filtered or unexported fields
}

Shift represents a shift.

func NewShift

func NewShift(cu *CurricularUnit, name string, sType string) *Shift

NewShift initializes a Shift and returns its adress.

func (*Shift) AddLesson

func (s *Shift) AddLesson(lesson *Lesson)

AddLesson appends a class to the shift.

func (*Shift) Equals

func (s *Shift) Equals(s2 *Shift) bool

Equals returns whether s is equal to s2, using the name as criteria.

func (*Shift) GetLessons

func (s *Shift) GetLessons() []*Lesson

GetLessons returns the lessons of the shift.

func (*Shift) GetName

func (s *Shift) GetName() string

GetName returns the name of the shift.

func (*Shift) GetType

func (s *Shift) GetType() string

GetType returns the type of shift.

func (*Shift) String

func (s *Shift) String() string

String representation of a Shift.

Jump to

Keyboard shortcuts

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