Project

General

Profile

Actions

Patch #33554

open

Fix by date weekly filter query to use Setting.start_of_week

Added by Konstantin Borisov over 4 years ago. Updated about 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Issues filter
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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.


Files

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

Updated by Mischa The Evil over 4 years 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.

Actions #2

Updated by Konstantin Borisov about 4 years 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.

Actions

Also available in: Atom PDF