## Inspiration

I was inspired to build this project because I've been tracking my work and sleep habits on a physical calendar for a while, so I thought it would be fun to build it into a webapp.

## What it does

I think sleep and work are both very important for your success, so they are both important parts of Slorz. By entering goals for working and sleeping, Slorz calculates your score every day based on how much you've actually worked and slept.

Slorz has three sections:

1. A record of your work/sleep in the past week. Each day contains a the number of work periods you've completed, your bedtime, and your score (more about the score calculation below)
2. Information about your activity today. Here, you can use the to-do list/work period planner to create a list of tasks that you want to do. Once you've completed a task, click the DONE! button, and your work period count for today will be incremented. Additionally, you can enter the time that you go to bed, which will be recorded and taken into consideration in the score calculation.
3. Your goals for today. Here, you enter what you are aiming to accomplish, both for work and for sleep.

### Score Calculation

The score takes into consideration both work and sleep. The formula is:

Score = Work points * Work periods completed / Target work periods + Sleep points * (1/2)^(|Actual bedtime - Target bedtime|/Bedtime points half-life)

There are a total of 100 points, which are split into Work points and Sleep points (70/30 by default).

The part of your score that you get from completing work is calculated by taking the ratio between Work periods completed and the Target work periods that you set in your goal, and multiplying that ratio by Work points.

The part that you get from sleeping is slightly more complicated. Your sleep score decays exponentially (similar to Carbon-14) when you stay up past your target bedtime. The decay is calculated by raising 1/2 to the power of the absolute difference between your Actual and Target bedtime divided by the half-life of the bedtime points. Your sleep score is the decay multiplied by the Sleep points. For example, if you set Sleep points to 40, you stay up 60 minutes past your bedtime, and your bedtime points half-life is 20 minutes, then your final sleep score is 40*(1/2)^(60/20) = 40*1/8 = 5.

## How I built it

I built Slorz using Rust with the Seed web framework.

## Challenges I ran into

It was difficult to deal with bedtime calculations, since a lot of people tend to stay up past midnight (not me during this hackathon).

## What's next for Slorz

• Graphing the data
• User account system