Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extractor for exams supervision #106

Merged
merged 15 commits into from
Mar 29, 2022
Merged

Conversation

fabiodrg
Copy link
Collaborator

@fabiodrg fabiodrg commented Mar 24, 2022

Changes

  • Create a class for representing a calendar event, CalEvent (Extend the 'Extractor' class for calendar event extracts #107).
  • Add a more specialised extractor class, EventExtractor, to distinguish between generic extractors and extractors that create calendar events.
    • The EventExtractor supports the format-strings for title and description, customisable via options UI (Extend the 'Extractor' class for calendar event extracts #107).
    • The extractor should create instances of CalEvent with the formatted strings to separate the semantics of extractors and events. Generating UI only needs the events objects with this approach
  • Create an utility class for generating URLs for the 'one-click' feature
  • Refactor the utility functions that generate the modal UI for downloading events and the dropdowns for adding singular events to Google/Microsoft/Yahoo calendars.
    • Supports CalEvent class
    • The custom recurrence rules now work for the ICS file, as well as 'one-click' events in the dropdowns
  • Add extractor for exams supervisions

Preview

image
image
image

@fabiodrg fabiodrg linked an issue Mar 24, 2022 that may be closed by this pull request
@fabiodrg fabiodrg changed the base branch from master to dev March 24, 2022 11:26
@fabiodrg fabiodrg force-pushed the feat/extractor-exams-supervision branch 2 times, most recently from 959212f to 6a64bde Compare March 26, 2022 20:57
Preparing work before seperating event extractors from generic extractors
This extractor is a more specialised version of the extractor supporting
specific features that do not make sense in generic extractors. For
instance, an event extractor has customisable fields for the title and
description (aka format-strings) which may be plaintext or HTML.
A new class to be used in extractors and other modules that represent
calendar events. It also supports recurring events and automatically
calculates start/end datetimes accordingly with the recurrence period
(see #110)
A flag that indicates wether the title and description are HTML or
plaintext. This is necessary to properly encode the strings when
generating the URLs to add events in google/microsoft/yahoo calendars
The new approach creates all the necessary DOM and adds event listeners
automatically. It also supports the new CalEvent class to represent
calendar events and generate the inline dropdowns from them
URL generation onclick

The need for URL generation is because the recurrence period can be
customised via the Modal interface. Therefore, the previous approach for
static inline URLs does not suit
@fabiodrg fabiodrg force-pushed the feat/extractor-exams-supervision branch from 1248424 to 689022d Compare March 27, 2022 18:42
CalEvent class

With this approach, it is possible to change the recurrence rules for
'one-click' events as well, as the URLs for dropdowns are generated
dynamically. Whenever the date changes, the events recurrence period is
updated accordingly
@fabiodrg fabiodrg force-pushed the feat/extractor-exams-supervision branch from cefe0ee to e8339a1 Compare March 27, 2022 19:43
Comment on lines +156 to +157
startTime: new Date(`${date} ${startTime}`),
endTime: new Date(`${date} ${endTime}`),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool hack

// add click action for the ICS download button
$dropdown.querySelector(".donwloadSingleIcs").addEventListener("click", (e) => {
const cal = ics("sigtools"); //creat ics instance
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const cal = ics("sigtools"); //creat ics instance
const cal = ics("sigtools"); //create ics instance

Comment on lines 136 to 137
for (const event of events)
event.setRecur(from, to);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (const event of events)
event.setRecur(from, to);
for (const event of events) {
event.setRecur(from, to);
}

I do like one-liner ifs/fors but I think they make code harder to maintain, so this is more of a suggestion, I've seen a few other ifs/fors, and I also accept if you prefer them. feel free to ignore this suggestion

@fabiodrg fabiodrg merged commit 1ae5baf into dev Mar 29, 2022
@fabiodrg fabiodrg moved this from In progress to Done in v4.2 Apr 4, 2022
@fabiodrg fabiodrg deleted the feat/extractor-exams-supervision branch April 6, 2022 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v4.2
  
Done
2 participants