Skip to content

Commit

Permalink
Merge pull request #36 from mgrachev/feature/add-time-estimate
Browse files Browse the repository at this point in the history
Add time estimate to tasks
  • Loading branch information
davydovanton committed Jan 12, 2017
2 parents 3d1c020 + f4b206f commit cc153eb
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .env.development
Expand Up @@ -6,3 +6,5 @@ WEB_SESSIONS_SECRET="c75d4d5429eb6e076b629ca1106c8cdd7f4ba9f91b7e0c37b6c106ecd13
ADMIN_SESSIONS_SECRET="c75d4d5429eb6e076b629ca1106c8cdd7f4ba9f91b7e0c37b6c106ecd1312b90"
AUTH_SESSIONS_SECRET="c75d4d5429eb6e076b629ca1106c8cdd7f4ba9f91b7e0c37b6c106ecd1312b90"
API_SESSIONS_SECRET="bdba67c5d3956e89798b6ceac28fdf7de6e84cc551347d17f13fdc4c4cc26e6c"
GITHUB_KEY=
GITHUB_SECRET=
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@
/node_modules
/coverage
/log
/.env.local
1 change: 1 addition & 0 deletions apps/admin/controllers/tasks/update.rb
Expand Up @@ -12,6 +12,7 @@ class Update
required(:lang).filled
required(:status).filled
required(:complexity).filled
required(:time_estimate).filled
optional(:issue_url).maybe(:str?)
optional(:repository_name).maybe(:str?)
end
Expand Down
2 changes: 2 additions & 0 deletions apps/admin/templates/tasks/index.html.slim
Expand Up @@ -7,6 +7,7 @@ table.table.pure-table.pure-table-horizontal
th.table__title Title
th.table__repository Repository
th.table__lang Language
th.table__time_estimate Time estimate
th.table__status Status
th.table__status Approved
th.table__created-at Created at
Expand All @@ -17,6 +18,7 @@ table.table.pure-table.pure-table-horizontal
td = link_to_task(task)
td = repository_name(task)
td = task.lang
td = task.time_estimate
td = status_label(task)
td = task_label(task)
td = task.created_at
4 changes: 4 additions & 0 deletions apps/admin/templates/tasks/show.html.slim
Expand Up @@ -26,6 +26,10 @@
.pure-u-1-8 Complexity
.pure-u-7-8 = task_complexity

.pure-g
.pure-u-1-8 Time estimate
.pure-u-7-8 = task_time_estimate

.pure-g
.pure-u-1-8 Language
.pure-u-7-8 = task.lang
Expand Down
11 changes: 11 additions & 0 deletions apps/admin/views/application_layout.rb
Expand Up @@ -11,6 +11,10 @@ def complexity_options_list
COMPLEXITY_OPTIONS_HASH
end

def time_estimate_options_list
TIME_ESTIMATE_OPTIONS_HASH
end

private

LANGUAGES_HASH = {
Expand All @@ -34,6 +38,13 @@ def complexity_options_list
'Medium' => 'medium',
'Hard' => 'hard',
}.freeze

TIME_ESTIMATE_OPTIONS_HASH = {
'Few days' => 'few days',
'More than a week' => 'more than a week',
'More than two weeks' => 'more than two weeks',
'More than month' => 'more than month'
}.freeze
end
end
end
5 changes: 5 additions & 0 deletions apps/admin/views/tasks/edit.rb
Expand Up @@ -25,6 +25,11 @@ def form
select :complexity, complexity_options_list
end

div class: 'input' do
label :time_estimate
select :time_estimate, time_estimate_options_list
end

div class: 'input task-form__field pure-control-group' do
label :md_body
text_area :md_body, task.md_body
Expand Down
4 changes: 4 additions & 0 deletions apps/admin/views/tasks/show.rb
Expand Up @@ -33,5 +33,9 @@ def task_label
def task_complexity
complexity_options_list.key(task.complexity)
end

def task_time_estimate
time_estimate_options_list.key(task.time_estimate)
end
end
end
1 change: 1 addition & 0 deletions apps/web/controllers/tasks/create.rb
Expand Up @@ -10,6 +10,7 @@ class Create
required(:md_body).filled(:str?)
required(:lang).filled(:str?)
required(:complexity).filled(:str?)
required(:time_estimate).filled(:str?)
required(:user_id).filled
optional(:issue_url).maybe(:str?)
optional(:repository_name).maybe(:str?)
Expand Down
3 changes: 3 additions & 0 deletions apps/web/templates/tasks/show.html.slim
Expand Up @@ -17,6 +17,9 @@
.task__complexity
| Complexity: #{task.complexity}

.task__time_estimate
| Time estimate: #{task.time_estimate}

.task__body
= task_body

Expand Down
11 changes: 11 additions & 0 deletions apps/web/views/application_layout.rb
Expand Up @@ -15,6 +15,10 @@ def complexity_options_list
COMPLEXITY_OPTIONS_HASH
end

def time_estimate_options_list
TIME_ESTIMATE_OPTIONS_HASH
end

def title
'OSSBoard'
end
Expand Down Expand Up @@ -42,6 +46,13 @@ def title
'Medium' => 'medium',
'Hard' => 'hard',
}.freeze

TIME_ESTIMATE_OPTIONS_HASH = {
'Few days' => 'few days',
'More than a week' => 'more than a week',
'More than two weeks' => 'more than two weeks',
'More than month' => 'more than month'
}.freeze
end
end
end
4 changes: 4 additions & 0 deletions apps/web/views/tasks/new.rb
Expand Up @@ -26,6 +26,10 @@ def form
select :complexity, complexity_options_list
end

div class: 'input' do
select :time_estimate, time_estimate_options_list
end

div class: 'input task-body', id: "task-body" do
div class: 'pure-menu pure-menu-horizontal pure-menu-scrollable is-center task-body__actions' do

Expand Down
5 changes: 5 additions & 0 deletions db/migrations/20170112163614_add_time_estimate_to_tasks.rb
@@ -0,0 +1,5 @@
Hanami::Model.migration do
change do
add_column :tasks, :time_estimate, String, default: 'few days'
end
end
6 changes: 5 additions & 1 deletion spec/admin/controllers/tasks/update_spec.rb
Expand Up @@ -17,6 +17,7 @@
md_body: 'This is *bongos*, indeed.',
lang: 'ruby',
complexity: 'medium',
time_estimate: 'more than month',
issue_url: 'github.com/issue/1',
approved: '1',
status: 'done'
Expand All @@ -35,6 +36,7 @@
expect(task.approved).to eq true
expect(task.lang).to eq 'ruby'
expect(task.complexity).to eq 'medium'
expect(task.time_estimate).to eq 'more than month'
expect(task.issue_url).to eq 'github.com/issue/1'
expect(task.status).to eq 'done'
end
Expand All @@ -47,6 +49,7 @@
md_body: 'This is *bongos*, indeed.',
lang: 'ruby',
complexity: 'medium',
time_estimate: 'more than month',
issue_url: '',
approved: '1',
status: 'done'
Expand All @@ -64,7 +67,8 @@
expect(task.body).to eq "<p>This is <em>bongos</em>, indeed.</p>\n"
expect(task.approved).to eq true
expect(task.lang).to eq 'ruby'
expect(task.complexity).to eq 'medium'
expect(task.complexity).to eq 'medium'
expect(task.time_estimate).to eq 'more than month'
expect(task.issue_url).to eq nil
end
end
Expand Down
3 changes: 2 additions & 1 deletion spec/fabricators/task_fabricator.rb
Expand Up @@ -7,6 +7,7 @@
issue_url { Faker::Internet.url('github.com', "/davydovanton/ossboard/issues/#{Faker::Number.number(2)}") }
approved false
lang :ruby
complexity :easy
complexity :easy
status 'in progress'
status 'few days'
end
5 changes: 4 additions & 1 deletion spec/web/controllers/tasks/create_spec.rb
Expand Up @@ -27,6 +27,7 @@
md_body: 'This is *bongos*, indeed.',
lang: 'test',
complexity: 'easy',
time_estimate: 'few days',
user_id: user.id,
issue_url: 'github.com/issue/1'
}
Expand Down Expand Up @@ -66,7 +67,8 @@
repository_name: '',
md_body: 'This is *bongos*, indeed.',
lang: 'test',
complexity: 'easy',
complexity: 'easy',
time_estimate: 'few days',
user_id: user.id,
issue_url: ''
}
Expand All @@ -82,6 +84,7 @@
expect(task.body).to eq "<p>This is <em>bongos</em>, indeed.</p>\n"
expect(task.issue_url).to eq nil
expect(task.complexity).to eq 'easy'
expect(task.time_estimate).to eq 'few days'
expect(task.status).to eq 'in progress'
end
end
Expand Down

0 comments on commit cc153eb

Please sign in to comment.