Skip to content

User Dashboard

Sachin Kumar K edited this page Oct 24, 2019 · 16 revisions

1. Introduction

1.1 Features

  • Stores user punch in and out time.
  • Total work time.
  • Allocate new task and track the timings.
  • Analyzed view of task and project timings.
  • User login authentication.

1.2 Product Scope

Application can be used in various companies where user works under some projects.

2. Descriptions

2.1 Login Authentication

Required inputs:

  • Email address
  • Password

Login authentication performed using Rest API.

Future scope: Initialize punch-in/out based on user presence on a WiFi zone (working location). Wifi MAC address should match with office Wifi MAC address (Set by admin).

2.2 Activity Track

Two conditions in initial load:

1. Opening first time on that date:

  • Update Punch in time
  • Start punch in timer
  • Start any task from the schedule or add new task
  • Update start time of task
  • Start task timer

2. Date already exist

  • Fetch previous timings of task and work time
  • Start task and punch in/out timer
  • Update database

Database will be updated in these five situations:

  • While opening application
  • Application moves to background
  • Application moves to foreground
  • Transition between application pages
  • Application terminated

2.3 Add New Task

Required inputs:

  • Task name
  • Task Description (Optional)
  • Project name

Actions:

  • Save task: Stores to the database all above fields except start time
  • Start task: Stores to the database with start time

2.4 User Activities

1. Day Activity View:

  • Displays all the tasks with respect to date
  • Representation in the form of single horizontal bar graph
  • X- axis label: from 8AM to 8PM
  • X- axis value: single horizontal bar graph represents user task timings

2. Week Activities View:

  • Displays all the tasks with respect to week
  • Representation in the form of vertical bar graph
  • X- axis label: from Monday to Sunday
  • Y- axis values: vertical bar graph represents user work timings
  • By clicking bar, page should move to the day activity view

3. Month Activities View:

  • Displays all the tasks with respect to month
  • Representation in the form of calendar
  • Each day will contains circle view which will describe total work time on that date
  • By clicking day in the calendar, page should move to the day activity view

2.2 Design and Implementation

2.2.1 Coredata design

Entities

  1. Projects(Project Id, Project Name, Project Icon Url, Total Time)
  2. PunchInOutTime(PunchId, Date, PunchIn Time, PunchOut Time, Total Time, Is User In Break, Work Start Time)
  3. Tasks(Task Id, Project Id, Task Name, Task Description, Start Time, End Time, Start Date, End Date, Total Time, Is Work In Progress, Work Start Time)
  4. BreakInformation(Break Id, Task Id, Date, Start Time, End Time)

All timings are stored in seconds for example, 12:00:00 AM as 0, 12:01:00 AM as 60, 08:00:00 AM as 28800, etc. Integer storage makes easy to calculate work and task timing with respect to the date.

Project table updated from admin panel and remaining 3 tables updated in client application. Entity data handled by 4 different classes:

  1. ProjectDBController for Projects
  2. UserTimesDBController for PunchInOutTime
  3. TasksDBController for Task
  4. TaskDBController for BreakInformation

2.2.2 Login

  • User login authentication performed using RequestController class by calling static function
    requestLogin(params: Dictionary<String, String>, url: String, completion: @escaping (_ success: Dictionary<String, Any>) -> Void)
    params: Key-Value pair containing username and password
    url: API url
    completion: Closure to handle the response

2.2.3 Activities

  • Create object of class ProjectDBController, UserTimesDBController, TasksDBController and TaskDBController in ActivityViewController to handle the coredata.
  • Check present date exists in the PunchInOutTime entity. If exists, update work and task timing by calling userTimesDBController.updateUserWorkTime() and taskDBController.updateUserTaskTime(). This will update task and work time by differentiating current time and previously application opened time. Example,
    Total working time = current time - previously stored time
    Suppose, previously stored time = 10:00:00 AM i.e 36000 and current time = 09:00:00 AM i.e. 32400
    then, total working time = 36000 i.e. 01:00:00 hour.
    If the logged in date doesn't exists in the coredata create new date by calling userTimesDBController.createNewDate()
  • Create Array of Dictionary object to store all the running task information. In viewDidLoad call arrayDictTaskDetails = taskDBController.getRunningTaskDetails this will return array of dictionary object. Based on the arrayDictTaskDetails update the tableview.
  • When application moves to background or foreground call userTimesDBController.updateUserWorkTime() and taskDBController.updateUserTaskTime() to update task and work timings.
  • Button state is used to stop and start work timings. When user stops the work time, update coredata using userTimesDBController.userStartsBreak() and while play call userTimesDBController.userFinishedBreak()
  • Button logout will clears all the coredata information by calling deleteAllData w.r.t 4 coredata objects.

2.2.4 Adding Task

  • TaskViewController handles adding new task. Update Tasks entity when user creates new task by calling taskDBController.addNewTask(projectId: projId, taskName: txtTaskName.text!, taskDesc: txtTaskDescr.text).
  • To start any task call taskDBController.startTask(taskId: taskId!) with respect to the task id.
  • User can also edit the task fields in edit mode. To update after editing call taskDBController.updateTaskNameDescriptionAndProject(taskId: taskId!, strTaskName: txtTaskName.text!, strDescr: txtVTaskDescr.text, projectId: projId)

2.2.5 My Activities

  • My Activities page contains three views to display in day, week and month wise data based on the user work and task timings.
  • Day view describes total work timings in a horizontal line graph. Here, x-axis will be time i.e. from 8AM to 8PM. UIBezierPath and CAShapeLayer are used to draw a graphs based on the each day work and task timings fetched from coredata.
  • Week view represents total worktime of each day in a week. The vertical bars are drawn with respect to the total timings. Here, y-axis represents total work time in hours.
  • Month view represents month wise total work timings.

3. User Interfaces

Clone this wiki locally