Patch #33554

Fix by date weekly filter query to use Setting.start_of_week

Added by Konstantin Borisov about 1 year ago. Updated 6 months ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues filter
Target version:-

Description

Currently when you search issues or time log entries with using "this week", "next week", "last week" and "last 2 week" conditions it uses current user locale setting of when the week is started. For example EN locale is using Sunday as week start and RU locale is using Monday week starts. We have a Setting.start_of_week that allow to configure when the calendar weeks should be started, but Issue filters ignores this setting.

This patch makes the fix, so the issues query use the Setting.start_of_week value configured for the Redmine instance for weekly queries. And it were possible to have issue queries with weeks started from Monday having the EN UI locale configured.

query_start_of_week.patch Magnifier (3.82 KB) Konstantin Borisov, 2020-06-04 17:29

History

#1 Updated by Mischa The Evil about 1 year ago

I like this change in general. I've seen cases where confusion about different query results arose in multilingual environments.
I don't think that coupling Query with Redmine::Helpers::Calendar in this way is a good idea, though. I think it would be better to extract both Redmine::Helpers::Calendar#first_wday and Redmine::Helpers::Calendar#last_wday into a new, encapsulated module (e.g. Redmine::Utils::DayCalculation) and use that where this logic is needed.

Note: this change will modify the results of existing custom queries for all users. While this is intentional, it might be something to take into account. Maybe it is best to mention it explicitly in the release announcement whenever this change is integrated and it gets released.

#2 Updated by Konstantin Borisov 6 months ago

I'm new in Redmine community. What are the usual procedures here? You've made some proposal about the implementation. Should it be voted and concluded somehow within contrubutors, or should I just rework my patch to proposed way to include it to release plan? How it works here, @Mischa_The_Evil please advice.

Also available in: Atom PDF