Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6fcc834617 | ||
|
|
9b28bf21e7 |
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Artem Kokos
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
> Предназначен для внутреннего использования в Eltex. Работает с `https://red.eltex.loc/`.
|
> Предназначен для внутреннего использования в Eltex. Работает с `https://red.eltex.loc/`.
|
||||||
|
|
||||||
|
📄 **Лицензия**: [MIT](./LICENSE) — делайте что угодно.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🔧 Возможности
|
## 🔧 Возможности
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ version = "1.0.0"
|
|||||||
description = "Redmine time-entry based issue reporter for internal use"
|
description = "Redmine time-entry based issue reporter for internal use"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [{ name = "Artem Kokos", email = "artem-kokos@mail.ru" }]
|
authors = [{ name = "Artem Kokos", email = "artem-kokos@mail.ru" }]
|
||||||
license = { text = "Proprietary" }
|
license = { text = "MIT" }
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from typing import List, Optional, Dict, Tuple
|
|||||||
from redminelib import Redmine
|
from redminelib import Redmine
|
||||||
from redminelib.resources import Issue
|
from redminelib.resources import Issue
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
from .utils import get_version
|
||||||
|
|
||||||
|
|
||||||
def fetch_issues_with_spent_time(from_date: str, to_date: str) -> Optional[List[Tuple[Issue, float]]]:
|
def fetch_issues_with_spent_time(from_date: str, to_date: str) -> Optional[List[Tuple[Issue, float]]]:
|
||||||
@@ -51,6 +52,7 @@ def fetch_issues_with_spent_time(from_date: str, to_date: str) -> Optional[List[
|
|||||||
total_hours = spent_time.get(issue.id, 0.0)
|
total_hours = spent_time.get(issue.id, 0.0)
|
||||||
result.append((issue, total_hours))
|
result.append((issue, total_hours))
|
||||||
|
|
||||||
# Сортируем по проекту (Redmine API уже сортирует, но для надёжности)
|
# Сортируем по (проект, версия)
|
||||||
result.sort(key=lambda x: str(x[0].project))
|
result.sort(key=lambda x: (str(x[0].project), get_version(x[0])))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from typing import List, Tuple
|
from typing import List, Tuple
|
||||||
from redminelib.resources import Issue
|
from redminelib.resources import Issue
|
||||||
|
from .utils import get_version
|
||||||
|
|
||||||
|
|
||||||
STATUS_TRANSLATION = {
|
STATUS_TRANSLATION = {
|
||||||
@@ -15,10 +16,6 @@ STATUS_TRANSLATION = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_version(issue: Issue) -> str:
|
|
||||||
return str(getattr(issue, 'fixed_version', '<N/A>'))
|
|
||||||
|
|
||||||
|
|
||||||
def hours_to_human(hours: float) -> str:
|
def hours_to_human(hours: float) -> str:
|
||||||
if hours <= 0:
|
if hours <= 0:
|
||||||
return "0ч"
|
return "0ч"
|
||||||
|
|||||||
2
redmine_reporter/utils.py
Normal file
2
redmine_reporter/utils.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
def get_version(issue) -> str:
|
||||||
|
return str(getattr(issue, 'fixed_version', '<N/A>'))
|
||||||
Reference in New Issue
Block a user