From 7a6ac0a28a07445b7b57e848e1f2a23f799d9dbb Mon Sep 17 00:00:00 2001 From: Malte S Date: Tue, 16 Jan 2024 14:09:36 +0100 Subject: [PATCH 1/9] initial commit for bug/fix_missing_translation From a4ba31ce0e48186a18c53141d3135db2e9c517af Mon Sep 17 00:00:00 2001 From: Malte S Date: Tue, 16 Jan 2024 14:12:57 +0100 Subject: [PATCH 2/9] add translation --- config/locales/en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 9e192024..f117fd1a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -87,6 +87,7 @@ en: remaining_holidays: Remaining holidays salary_history: Salary History slack_profile: + non_working_status_text: Non-working day paid_status_text: On vacation sick_status_text: On sick leave unpaid_status_text: Away From dc79bd795dbd821749c3380f0787a67cc7ccbff6 Mon Sep 17 00:00:00 2001 From: Malte S Date: Tue, 16 Jan 2024 14:13:14 +0100 Subject: [PATCH 3/9] prettify syntax --- app/views/leaves/_leave.html.slim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/leaves/_leave.html.slim b/app/views/leaves/_leave.html.slim index 39eb382f..8c824f4c 100644 --- a/app/views/leaves/_leave.html.slim +++ b/app/views/leaves/_leave.html.slim @@ -5,7 +5,7 @@ .card__icon = leave.unicode_emoji .card__header-content .card__title = [leave.user.display_name, leave.title].map(&:presence).compact.join(" / ") - .card__subtitle #{date_range leave.leave_during.min, leave.leave_during.max, format: :long} (#{leave.days.count} days) + .card__subtitle #{date_range leave.days.first, leave.days.last, format: :long} (#{leave.days.count} days) / i18n-tasks-use t('leave.status.approved') / i18n-tasks-use t('leave.status.rejected') / i18n-tasks-use t('leave.status.pending_approval') From 9aca75a020ce5a169c26e941edc899722a5078a1 Mon Sep 17 00:00:00 2001 From: Malte S Date: Tue, 16 Jan 2024 14:20:50 +0100 Subject: [PATCH 4/9] add magic comment for i18n --- app/models/user/slack_profile.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/user/slack_profile.rb b/app/models/user/slack_profile.rb index fd52f8b8..e17c97a7 100644 --- a/app/models/user/slack_profile.rb +++ b/app/models/user/slack_profile.rb @@ -14,6 +14,7 @@ def set_status(type:, emoji:, until_date:) # i18n-tasks-use t("users.slack_profile.paid_status_text") # i18n-tasks-use t("users.slack_profile.sick_status_text") # i18n-tasks-use t("users.slack_profile.unpaid_status_text") + # i18n-tasks-use t("users.slack_profile.non_working_status_text") Slack.instance.set_status(slack_id: ensure_slack_id!, text: I18n.t("users.slack_profile.#{type}_status_text"), emoji:, until_time: until_date.end_of_day) end From d421bc52b37399f7a37812debe544a122051af58 Mon Sep 17 00:00:00 2001 From: Malte S Date: Tue, 16 Jan 2024 14:33:41 +0100 Subject: [PATCH 5/9] fix test --- spec/models/sprint_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/models/sprint_spec.rb b/spec/models/sprint_spec.rb index dc66887b..df36ae3f 100644 --- a/spec/models/sprint_spec.rb +++ b/spec/models/sprint_spec.rb @@ -93,6 +93,7 @@ end it "mentions birthdays" do + travel_to "2023-01-23" john.update! born_on: "1989-02-01", hired_on: "2019-04-25" sprint.send_sprint_start_notification text = <<~TEXT From 5e24b1157efc4d080d3e43c12343361decd66355 Mon Sep 17 00:00:00 2001 From: Malte S Date: Tue, 16 Jan 2024 15:46:48 +0100 Subject: [PATCH 6/9] remove deletion of tasks --- app/models/task.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/models/task.rb b/app/models/task.rb index 6a10c556..44eb6a60 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -28,8 +28,6 @@ def sync_with_github project_ids_by_repository = Project.pluck(:repositories, :id).flat_map { |repositories, project_id| repositories.map { |repository| [repository, project_id] } }.to_h sprint_ids_by_title = Sprint.pluck(:title, :id).to_h github_tasks = Github.new.sprint_board_items - current_github_ids = pluck(:github_id) - deleted_ids = current_github_ids - github_tasks.map(&:id).compact tasks = github_tasks.map do |gt| { @@ -45,8 +43,6 @@ def sync_with_github end Task.transaction do - Task.where(github_id: deleted_ids).destroy_all if deleted_ids.any? - if tasks.any? task_ids_by_github_id = Task.upsert_all(tasks, returning: [:github_id, :id], unique_by: [:github_id]).rows.to_h From 8e612be4dbe3b70982f078f9f3d28774b2db9f6c Mon Sep 17 00:00:00 2001 From: Malte S Date: Tue, 16 Jan 2024 15:46:55 +0100 Subject: [PATCH 7/9] adapt spec --- spec/models/task_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/models/task_spec.rb b/spec/models/task_spec.rb index a4c259a6..2c02c0ab 100644 --- a/spec/models/task_spec.rb +++ b/spec/models/task_spec.rb @@ -77,12 +77,12 @@ expect(task.status).to eq "Done" end - it "deletes tasks that are not in the list" do + it "keeps tasks that are not in the list anymore" do task = tasks :done Task.sync_with_github - expect(Task.exists?(task.id)).to eq false + expect(Task.exists?(task.id)).to eq true end it "only updates finished_storypoints" do From 4ff695abbbe1e6c0567e6699ffbb82d8a5f5e86e Mon Sep 17 00:00:00 2001 From: Malte S Date: Tue, 16 Jan 2024 15:54:31 +0100 Subject: [PATCH 8/9] revert changes --- app/models/task.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/task.rb b/app/models/task.rb index 44eb6a60..6a10c556 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -28,6 +28,8 @@ def sync_with_github project_ids_by_repository = Project.pluck(:repositories, :id).flat_map { |repositories, project_id| repositories.map { |repository| [repository, project_id] } }.to_h sprint_ids_by_title = Sprint.pluck(:title, :id).to_h github_tasks = Github.new.sprint_board_items + current_github_ids = pluck(:github_id) + deleted_ids = current_github_ids - github_tasks.map(&:id).compact tasks = github_tasks.map do |gt| { @@ -43,6 +45,8 @@ def sync_with_github end Task.transaction do + Task.where(github_id: deleted_ids).destroy_all if deleted_ids.any? + if tasks.any? task_ids_by_github_id = Task.upsert_all(tasks, returning: [:github_id, :id], unique_by: [:github_id]).rows.to_h From d9ebdaff531bf57281d927edf15428900124fe29 Mon Sep 17 00:00:00 2001 From: Malte S Date: Tue, 16 Jan 2024 15:56:37 +0100 Subject: [PATCH 9/9] revert spec --- spec/models/task_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/models/task_spec.rb b/spec/models/task_spec.rb index 2c02c0ab..a4c259a6 100644 --- a/spec/models/task_spec.rb +++ b/spec/models/task_spec.rb @@ -77,12 +77,12 @@ expect(task.status).to eq "Done" end - it "keeps tasks that are not in the list anymore" do + it "deletes tasks that are not in the list" do task = tasks :done Task.sync_with_github - expect(Task.exists?(task.id)).to eq true + expect(Task.exists?(task.id)).to eq false end it "only updates finished_storypoints" do