assignment

package module
v0.0.0-...-d04ce0e Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

README

Assignments

Assignments is a utility that will allow you to seamlessly be up-to-date with the state of your assignments.

Features

Prints the assignments of your enrolled courses to the terminal. These are the following options available for convenience:

  • Inclusion of expired assignments: usually there are expired assignments from previous years. (default = false)

  • Include only favorite courses: fetch only courses marked as 'favorites'. (default = false)

  • Exclusion of selected courses: there are courses that do not have assignments. (default = empty)

  • Exclusion of selected assignments: professors tend to divide assignments in a non-common pattern like per lab classes. (default = empty)

  • Export an ICS file: produces a calendar file that can be imported from any calendar app. See here. (default = false)

  • Plain text: The output will be printed in csv format instead of a table. (default = false)

Installation

  1. See releases for pre-built binaries.
  2. Install as go package (requires Go)
go install github.com/Huray-hub/eclass-utils/assignment/cmd/assignments@latest
  1. Build from source (requires Go).
  • clone repo
  • cd into the repo
  • install
go install ./assignment/cmd/assignments
  • run
assignments

Configuration

Location

After the installation, a yaml file will be stored in one of the following locations:

  • Unix
    • XDG_CONFIG_HOME/.config/eclass-utils/config.yaml
    • ~/.config/eclass-utils/config.yaml
  • Windows
    • %AppData%/eclass-utils/config.yaml
  • MacOS
    • no idea I'm poor
File structure

Configuration file looks like this:

credentials:
    username: your-eclass-username
    password: your-eclass-password-ENCRYPTED
options:
    plainText: false # print output in csv format instead of pretty table
    includeExpired: false # include expired assignments
    exportICS: false # export calendar file (for import to calendar apps) 
    excludedCourses: # the following course codes are excluded
        CS179: 
        ICE257: 
        ICE290: 
    excludedAssignments:
        # for course code ICE245, assignments containing these strings are excluded
        ICE245: 
            - ΗΛΕΚ01
            - ΗΛΕΚ02
            - ΗΛΕΚ03
            - ΗΛΕΚ05
        CS157:
            - ΓΙΑ ΟΣΟΥΣ ΔΕΝ ΑΝΗΚΟΥΝ ΣΕ ΚΑΠΟΙΟ ΤΜΗΜΑ
        ICE325:
            - '15η εργασία : Εκπρόθεσμες υποβολές ασκήσεων.'
            - 6. Απαλλακτική εργασία
        ICE326:
            - Άσκηση (project) Εργαστηρίου - 2023
    baseDomain: eclass.uniwa.gr # domain of your university
    onlyFavoriteCourses: false # include only favorite courses
secretKey: generated-secret-key # always ignore this one

Command-line-flags

  • Use -h for help

Note that in the runtime, cmd-flags override the config file (will not modify the file)

Authentication

College password can be cached, encrypted in the config file. It can't be update it manually from config file.

Use -h for help

Documentation

Index

Constants

View Source
const NoDeadline = "Χωρίς προθεσμία"

Variables

This section is empty.

Functions

func SortByDeadline

func SortByDeadline(a []Assignment)

SortByDeadline function sorts assignments by descending deadline

Types

type Assignment

type Assignment struct {
	ID       string
	Course   *course.Course
	Title    string
	Deadline *time.Time
	IsSent   bool
}

func (Assignment) IsExcluded

func (a Assignment) IsExcluded(
	opts config.Options,
	courseID string,
	location *time.Location,
) bool

IsExcluded method determines if the assignment should be excluded from final result

func (*Assignment) PrepareURL

func (a *Assignment) PrepareURL(baseURL string) (string, error)

PrepareURL method prepares URL for assignments' own page

func (*Assignment) String

func (a *Assignment) String() string

type Service

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

func NewService

func NewService(
	ctx context.Context,
	cfg config.Config,
	client *http.Client,
) (*Service, error)

func (*Service) FetchAssignments

func (svc *Service) FetchAssignments(ctx context.Context) ([]Assignment, error)

FetchAssignments method will retrieve all assignments of your assignments and filter them out based on Service's options.

1. retrieves enrolled courses,

2. concurrently fans-out each course's http request + assignment scrapping through channels,

3. fans-in channels' result into one,

4. sorts them by deadline

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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