Files
vetro_redmine/tasks.py

45 lines
1.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from api import api
from datetime import date, timedelta
from constants import (
VETRO_PROJECT_ID,
PROD_SUPPORT_TRACKER_ID,
WORK_STATUS_ID,
NORMAL_PRIORITY_ID,
EXECUTOR_FIELD_ID,
RESPONSIBLE_FIELD_ID
)
def release_current_version() -> None:
version = api.get_current_version()
issues = api.get_release_issues(version["id"])
for issue in issues:
api.release_issue(issue["id"])
def add_version() -> None:
today = date.today()
api.add_version({
"name": today.strftime("RELEASE-%d%m%y"),
"due_date": (today + timedelta(weeks=1)).isoformat(),
"description": today.strftime("Релиз от %d.%m.%y"),
"sharing": "descendants"
})
def add_release_issue() -> None:
today = date.today()
user = api.get_current_user()
api.add_issue(
{
"project_id": VETRO_PROJECT_ID,
"tracker_id": PROD_SUPPORT_TRACKER_ID,
"status_id": WORK_STATUS_ID,
"priority_id": NORMAL_PRIORITY_ID,
"subject": today.strftime("Релиз (%d.%m.%Y)"),
"description": "Выложить задачи со статусом Ожидает релиз в production.",
"assigned_to_id": "me",
"custom_fields": [
{"id": EXECUTOR_FIELD_ID, "value": user["id"]}, {"id": RESPONSIBLE_FIELD_ID, "value": "Фадеев Виктор"}
]
}
)