PROJECT: ConTAct


Overview

ConTAct is a desktop application designed to help teaching assistants by providing them with multiple features that are catered specifically to easing student management.

Tutors interact with the application through the CLI, and the GUI is implemented using JavaFX. The app itself is written in Java.

Summary of contributions

  • Major Enhancement: added Email feature in ConTAct

    • What it does: allows the user to email a student directly from the application through an input to the CLI

    • Justification: this feature significantly enhances the product by easing the process of emailing a student, making it quicker.

    • Highlights: The feature includes a simple email command with which the subject and content can all be set, just through a single command. It required an in-depth anaylsis of how working with REST-ful API worked, and how to integrate it with a native application. It was a challenge to make it allow any NUS Outlook user be able to sign-in with his/her email and send an email to their student. Other challenges included ensuring security, receiving permission from users, and understanding the flow of the authorization-code grant method of getting an access token.

    • Credits: The Outlook API usage online provided by Outlook itself served as a good guidance in implementing this.

  • Code contributed: RepoSense Report

  • Other Contributions:

    • Project Management:

      • Managed the team and reminded members of deadlines, keeping them on track.

    • Community:

Contributions to User Guide

Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users.

Emailing a student: email

Allows the user to email a specific student.
Format: email INDEX s/SUBJECT b/BODY

  • The subject of the email is specified after the s/ and the body after the b/.

  • The user can specify one student index, after the email command word.

  • The user will be redirected to an Outlook sign in page, and has to give consent to allow the application to send the mail on the user’s behalf.

Examples:

  • email 2 s/Attendance Problem b/Your attendance is poor. Is there a problem?
    This gathers the email address of the student at index 2, and sets the subject and body respectively. It then asks the user for permission to send the email on their behalf and once the user consents, it sends the email.

Contributions to the Developer Guide

Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project.

Email feature

Current implementation - Emailing a single student

The email feature is faciliated by Outlook Mail API, since most NUS teaching assistants have an Outlook account.

This API is a RESTful API, made for server-client communication. Since the Outlook mail API is a RESTful API, this feature uses the 'POST' request (which requests that the web server accepts the data enclosed in the body of the request message) to send the email specified in the user-input to the student specified in the user-input.

Component Interactions Email
Figure 1. Component interactions for Email command

The email command itself takes a few parameters:

  • Index: Index number of student in list. Only positive numbers present in list are valid.

  • Subject: Subject of email to be sent, valid if not an empty string.(s/)

  • Body: Subject of email to be sent, valid if not an empty string.(b/)

e.g email 2 s/Attendance poor. b/Your attendance seems to be poor. Is there a problem?

When the user inputs the email command in the CLI, the input is parsed, and the email address of the student at the index specified, the subject, and body of the email specified are recognized and extracted.

The subject and body are converted to JSON, and passed as the body of the 'POST' request to Outlook, along with the access token that is also retrieved through a series of requests to the server.

Sequence Diag Logic
Figure 2. Sequence Diagram for Email command

The CommandResult object that is returned by the email command lets the user know that the email address has been successfully send to the student whose index is specified.

Retrieving access token for the request:

When the user uses the command, he/she is redirected to a browser window of Outlook’s sign in page. Once they sign in, they will be asked for their permission for the application to send e-mails on their behalf. Once they accept and give consent, the response is sent from the server back to the application, containing the authorization code.

This authorization code is then extracted from the response and used to request for the access token, which is what is ultimately needed in order to interact with the server and send the mail.

Using the authorization code in the request, the access token is retrieved. Once the access token is extracted from the response and available for use, the actual POST request to send the email is made.

Request Sequence Diagram
Figure 3. Within the App interactions and the App’s interactions with Outlook

Design Considerations:

  • GUI design: Using the browser panel to display the email drafting page of Outlook

    • Pros: Gives the user a more visual aid in drafting their message, making it easy to type longer messages

  • Input: Allow the user to type the index the subject and the body of the email in 3 seperate inputs

    • Pros: Less confusing for user, as there is no need to follow the set email 2 s/subject b/body design. The user can type the index, press enter, and then the subject, press enter, and then the body finally. This would ease the users experience.

Proposed additions for v2.0:

  • Emailing an entire group/class through the CLI, using the grouping feature

  • Sending emails with attachments to students

  • Pre-written email templates that the user can just send out to students

Use case: Email students

MSS

  1. User requests to email a students at an index

  2. ConTAct fetches the email of the student

  3. User types in the email header and body after the index

  4. ConTAct sends out the email

    Use case ends.

Extensions

  • 1a. The index is invalid.

    • 1a1. ConTAct shows an error message.

      Use case ends.

  • 2a. The list of student emails is empty

    • 2a1. ConTAct shows an error message.

      Use case ends.

Emailing a student

Manual Testing for sending an email to a student:

  1. Prerequisites: The student must exist on the list, at the correct index. If student does not exist yet, add student first.

  2. Test case: email 1 s/Attendance b/Your attendance is good
    Expected: Email sent to student at index '1' and success message shown in status message.

  3. Test case: email 1 s/Attendance! b/Your attendance is very good!!!
    Expected: Email sent to student at index '1' and success message shown in status message.

  4. Test case: email 0 s/Attendance b/Your attendance is good!
    Expected: No student is emailed. Error details shown in status message.

  5. Test case: email 1 s/ b/
    Expected: No student is emailed. Error details shown in status message.

  6. Test case: email 1 x/subject y/body
    Expected: No student is emailed. Error details shown in status message.

  7. Other incorrect email commands to try: email, email 1, email 1 s/subject, email x s/subject b/body (where x is larger than the list size)
    Expected: Similar to previous