-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
app/controllers/api/products/unassigned_text_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
class API::Products::UnassignedTextController < API::BaseController | ||
def show | ||
@products = Product | ||
.unassigned | ||
.unchecked | ||
.not_wip | ||
.list | ||
.order_for_not_wip_list | ||
@passed5 = @products.count { |product| product.elapsed_days == 5 } | ||
@passed6 = @products.count { |product| product.elapsed_days == 6 } | ||
@over7 = @products.count { |product| product.elapsed_days >= 7 } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<% if @passed5 + @passed6 + @over7 > 0 %> | ||
提出されてから日数が経っている提出物の数をお知らせします。 | ||
|
||
<% if @passed5 > 0 %> | ||
- 5日経過:<%= @passed5 %>件 | ||
<% end %> | ||
<% if @passed6 > 0 %> | ||
- 6日経過:<%= @passed6 %>件 | ||
<% end %> | ||
<% if @over7 > 0 %> | ||
- 7日以上経過:<%= @over7 %>件 | ||
<% end %> | ||
|
||
<% else %> | ||
提出されたから5日以上経過している提出物はありません。 | ||
メンターの皆様、日々の提出物の確認ありがとうございます。 | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'test_helper' | ||
|
||
class API::Products::UnassignedTextTest < ActionDispatch::IntegrationTest | ||
fixtures :products | ||
|
||
test 'GET /api/products/unassigned_text.txt' do | ||
get api_products_unassigned_text_path(format: :text) | ||
assert_response :unauthorized | ||
|
||
token = create_token('komagata', 'testtest') | ||
get api_products_unassigned_text_path(format: :text), | ||
headers: { 'Authorization' => "Bearer #{token}" } | ||
assert_response :ok | ||
assert_match '5日経過:1件', response.body | ||
assert_match '6日経過:1件', response.body | ||
assert_match '7日以上経過:6件', response.body | ||
end | ||
end |