\documentclass[a4paper,english]{article}

\title{Making Appointments\\\Large{Advanced Programming assignment 7}}
\author{Camil Staps}

\usepackage[margin=25mm,bottom=35mm]{geometry}
\usepackage{graphicx}
\usepackage[hidelinks]{hyperref}
\usepackage{cleveref}
\usepackage{csquotes}
\usepackage{minted}

\begin{document}

\maketitle

\noindent\emph{The screenshots included here are also in higher resolution included in the tarball.}

\section{Showing appointments}
There are two ways of showing appointments.
All future appointments can be shown in a list (\cref{fig:show-list}).
The appointments for the current week can be shown in an SVG calendar (\cref{fig:show-svg}).
This can of course be extended to see other weeks as well, but it was really just to try out SVG.

\begin{figure}[b]
	\includegraphics[width=\textwidth]{show-list}
	\caption{Showing future appointments as a list.\label{fig:show-list}}
\end{figure}
\begin{figure}[b]
	\includegraphics[width=\textwidth]{show-svg}
	\caption{Showing current week as an SVG calendar.\label{fig:show-svg}}
\end{figure}

\section{Making appointments}
The default start time is the next whole hour.
Other than that, this part is not much different than the screenshot in the assignment.
It was not clear to me what the \enquote{scheduled appointments} field should do, so I omitted it.
Users are not automatically participants in their own appointment which is the decision that gives most user freedom.
See \cref{fig:make}.

\begin{figure}[b]
	\includegraphics[width=\textwidth]{make}
	\caption{Making a new appointment.\label{fig:make}}
\end{figure}

\section{Proposing appointments}
Proposed appointments are stored in a new type and stored in a separate share.

\inputminted[firstline=114,lastline=117]{clean}{appointments.icl}
\inputminted[firstline=102,lastline=105]{clean}{appointments.icl}

The interface for creating an appointment proposal is straightforward (\cref{fig:propose}).
Participants get tasks to indicate their availability (\enquote{Yes}, \enquote{No} or \enquote{Maybe}; \cref{fig:propose-avail}).
The owner can always pick a start time or cancel the appointment (\cref{fig:propose-manage}).
In both cases, the tasks to indicate availability are removed;
	in the first case, tasks to finish the appointment are created (see \cref{sec:user-tasks}).

\begin{figure}[b]
	\includegraphics[width=\textwidth]{propose}
	\caption{Proposing an appointment.\label{fig:propose}}
\end{figure}
\begin{figure}[b]
	\includegraphics[width=\textwidth]{propose-avail}
	\caption{Indicating availability for a proposed appointment.\label{fig:propose-avail}}
\end{figure}
\begin{figure}[b]
	\includegraphics[width=\textwidth]{propose-manage}
	\caption{Managing a proposed appointment.\label{fig:propose-manage}}
\end{figure}

\section{User tasks}
\label{sec:user-tasks}
User tasks are visible from the moment that they are created,
	but can only be finished
		(properly; they can always be deleted due to the usage of \texttt{loginAndManageWorkList})
		after the start time (\cref{fig:user-early}).
During the appointment, the user can finish a task by clicking \enquote{Done} (\cref{fig:user-task}).
User tasks disappear after the end time.

\begin{figure}[b]
	\includegraphics[width=\textwidth]{user-early}
	\caption{View when the user opens a task which does not start yet.\label{fig:user-early}}
\end{figure}
\begin{figure}[b]
	\includegraphics[width=\textwidth]{user-task}
	\caption{View to finish a task.\label{fig:user-task}}
\end{figure}

\section{Overall design \& feedback requests}
I tried to separate model and view/controller.
For instance, there are \texttt{addAppointment :: Appointment -> Task Appointment} and
	\texttt{addProposedAppointment :: ProposedAppointment -> Task Int} which do not handle user interaction
	but add a (proposed) appointment to the right share and start up related tasks.
The relevant interaction tasks, \texttt{makeAppointment} and \texttt{proposeAppointment},
	are just wrappers around the model tasks.
I think something like this may be possible with lenses, i.e.,
	change the addition function of the shares to add the user tasks.
I have not tried to find this out, but would like some feedback on that.

Also, you can see that to update start options users modify the map of availabilities of the proposed appointment.
For this they also need to be able to find the appointment in the list of proposed appointment,
	so the proposed appointments share is a tuple of an index for the next proposed appointment and a \texttt{Map Int ProposedAppointment} for the proposed apointments themselves.
I expect that this can be done neater as well, possibly with lenses, so would like feedback on that as well.

\section{Known bugs}
This program is affected by bug \href{https://gitlab.science.ru.nl/clean-and-itasks/iTasks-SDK/issues/181}{\#181}.

It was affected by \href{https://gitlab.science.ru.nl/clean-and-itasks/iTasks-SDK/issues/188}{\#188},
	but this has been resolved. So, make sure to run with the latest version (this program has been tested with 2017-11-12).

Some workarounds were needed for \href{https://gitlab.science.ru.nl/clean-and-itasks/iTasks-SDK/issues/190}{\#190}.
Particularly, that bug made it difficult to do client-side date handling.
This required me to give the \texttt{editor} and \texttt{draw} functions in \texttt{showCalendar} a \texttt{[Date]} argument,
	thereby moving the \texttt{take 7 \$ iterate nextDay \$ previous Sunday date} to the server.
I would find it preferable to move that computation to the \texttt{draw} function.

\end{document}
