Bump version to 3.4.2: improve date comparison in TaskList and enhance CI notifications
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 33s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 33s
This commit is contained in:
@@ -49,13 +49,22 @@ jobs:
|
|||||||
REGISTRY="dungeonsiege.synology.me/poignatov/play-life"
|
REGISTRY="dungeonsiege.synology.me/poignatov/play-life"
|
||||||
VER="${{ steps.version_check.outputs.current }}"
|
VER="${{ steps.version_check.outputs.current }}"
|
||||||
|
|
||||||
|
echo "Building Docker image..."
|
||||||
|
echo "Registry: $REGISTRY"
|
||||||
|
echo "Tags: latest, $VER"
|
||||||
|
|
||||||
# Собираем один раз
|
# Собираем один раз
|
||||||
docker build -t $REGISTRY:latest -t $REGISTRY:$VER .
|
docker build -t $REGISTRY:latest -t $REGISTRY:$VER .
|
||||||
|
|
||||||
# Пушим оба тега
|
# Пушим оба тега
|
||||||
|
echo "Pushing image to registry..."
|
||||||
docker push $REGISTRY:latest
|
docker push $REGISTRY:latest
|
||||||
docker push $REGISTRY:$VER
|
docker push $REGISTRY:$VER
|
||||||
|
|
||||||
|
echo "✅ Successfully pushed to registry:"
|
||||||
|
echo " - $REGISTRY:latest"
|
||||||
|
echo " - $REGISTRY:$VER"
|
||||||
|
|
||||||
- name: Send Telegram notification (success)
|
- name: Send Telegram notification (success)
|
||||||
if: success() && steps.version_check.outputs.changed == 'true'
|
if: success() && steps.version_check.outputs.changed == 'true'
|
||||||
uses: appleboy/telegram-action@master
|
uses: appleboy/telegram-action@master
|
||||||
@@ -63,10 +72,12 @@ jobs:
|
|||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
message: |
|
message: |
|
||||||
✅ Сборка успешна!
|
✅ Сборка и публикация успешны!
|
||||||
|
|
||||||
Проект: play-life
|
Проект: play-life
|
||||||
Версия: ${{ steps.version_check.outputs.current }}
|
Версия: ${{ steps.version_check.outputs.current }}
|
||||||
|
Registry: dungeonsiege.synology.me/poignatov/play-life
|
||||||
|
Теги: latest, ${{ steps.version_check.outputs.current }}
|
||||||
Ветка: ${{ github.ref_name }}
|
Ветка: ${{ github.ref_name }}
|
||||||
Коммит: ${{ github.sha }}
|
Коммит: ${{ github.sha }}
|
||||||
|
|
||||||
|
|||||||
@@ -315,54 +315,6 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, onRefresh }) {
|
|||||||
return !isNaN(value) && value === 0
|
return !isNaN(value) && value === 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Функция для парсинга PostgreSQL INTERVAL и добавления к дате
|
|
||||||
const addIntervalToDate = (date, intervalStr) => {
|
|
||||||
if (!intervalStr) return null
|
|
||||||
|
|
||||||
const result = new Date(date)
|
|
||||||
|
|
||||||
// Парсим строку интервала (формат: "1 day", "2 hours", "3 months", etc.)
|
|
||||||
const parts = intervalStr.trim().split(/\s+/)
|
|
||||||
if (parts.length < 2) return null
|
|
||||||
|
|
||||||
const value = parseInt(parts[0], 10)
|
|
||||||
if (isNaN(value)) return null
|
|
||||||
|
|
||||||
const unit = parts[1].toLowerCase()
|
|
||||||
|
|
||||||
switch (unit) {
|
|
||||||
case 'minute':
|
|
||||||
case 'minutes':
|
|
||||||
result.setMinutes(result.getMinutes() + value)
|
|
||||||
break
|
|
||||||
case 'hour':
|
|
||||||
case 'hours':
|
|
||||||
result.setHours(result.getHours() + value)
|
|
||||||
break
|
|
||||||
case 'day':
|
|
||||||
case 'days':
|
|
||||||
result.setDate(result.getDate() + value)
|
|
||||||
break
|
|
||||||
case 'week':
|
|
||||||
case 'weeks':
|
|
||||||
result.setDate(result.getDate() + value * 7)
|
|
||||||
break
|
|
||||||
case 'month':
|
|
||||||
case 'months':
|
|
||||||
result.setMonth(result.getMonth() + value)
|
|
||||||
break
|
|
||||||
case 'year':
|
|
||||||
case 'years':
|
|
||||||
result.setFullYear(result.getFullYear() + value)
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Группируем задачи по проектам
|
// Группируем задачи по проектам
|
||||||
const groupedTasks = useMemo(() => {
|
const groupedTasks = useMemo(() => {
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
@@ -382,8 +334,7 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, onRefresh }) {
|
|||||||
let isCompleted = false
|
let isCompleted = false
|
||||||
let isInfinite = false
|
let isInfinite = false
|
||||||
|
|
||||||
// Если next_show_at установлен, задача всегда в выполненных (если дата в будущем)
|
// Используем только next_show_at для группировки
|
||||||
// даже если она бесконечная (next_show_at приоритетнее всего)
|
|
||||||
if (task.next_show_at) {
|
if (task.next_show_at) {
|
||||||
const nextShowDate = new Date(task.next_show_at)
|
const nextShowDate = new Date(task.next_show_at)
|
||||||
nextShowDate.setHours(0, 0, 0, 0)
|
nextShowDate.setHours(0, 0, 0, 0)
|
||||||
@@ -393,41 +344,10 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, onRefresh }) {
|
|||||||
// Если у задачи период повторения = 0 и нет next_show_at, она в бесконечных
|
// Если у задачи период повторения = 0 и нет next_show_at, она в бесконечных
|
||||||
isInfinite = true
|
isInfinite = true
|
||||||
isCompleted = false
|
isCompleted = false
|
||||||
} else if (task.repetition_period) {
|
|
||||||
// Если есть repetition_period (и он не 0), проверяем логику повторения
|
|
||||||
// Используем last_completed_at + period
|
|
||||||
let nextDueDate = null
|
|
||||||
|
|
||||||
if (task.last_completed_at) {
|
|
||||||
const lastCompleted = new Date(task.last_completed_at)
|
|
||||||
nextDueDate = addIntervalToDate(lastCompleted, task.repetition_period)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nextDueDate) {
|
|
||||||
// Округляем до начала дня
|
|
||||||
nextDueDate.setHours(0, 0, 0, 0)
|
|
||||||
|
|
||||||
// Если nextDueDate > today, то задача в выполненных
|
|
||||||
isCompleted = nextDueDate.getTime() > today.getTime()
|
|
||||||
} else {
|
|
||||||
// Если не удалось определить дату, используем старую логику
|
|
||||||
if (task.last_completed_at) {
|
|
||||||
const completedDate = new Date(task.last_completed_at)
|
|
||||||
completedDate.setHours(0, 0, 0, 0)
|
|
||||||
isCompleted = completedDate.getTime() === today.getTime()
|
|
||||||
} else {
|
} else {
|
||||||
|
// Если нет next_show_at и период не 0, задача в обычных
|
||||||
isCompleted = false
|
isCompleted = false
|
||||||
}
|
isInfinite = false
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Если нет ни repetition_period, ни repetition_date, используем старую логику
|
|
||||||
if (task.last_completed_at) {
|
|
||||||
const completedDate = new Date(task.last_completed_at)
|
|
||||||
completedDate.setHours(0, 0, 0, 0)
|
|
||||||
isCompleted = completedDate.getTime() === today.getTime()
|
|
||||||
} else {
|
|
||||||
isCompleted = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
projects.forEach(projectName => {
|
projects.forEach(projectName => {
|
||||||
@@ -501,16 +421,22 @@ function TaskList({ onNavigate, data, loading, backgroundLoading, onRefresh }) {
|
|||||||
</div>
|
</div>
|
||||||
{task.next_show_at && (() => {
|
{task.next_show_at && (() => {
|
||||||
const showDate = new Date(task.next_show_at)
|
const showDate = new Date(task.next_show_at)
|
||||||
showDate.setHours(0, 0, 0, 0)
|
// Нормализуем дату: устанавливаем время в 00:00:00 в локальном времени
|
||||||
|
const showDateNormalized = new Date(showDate.getFullYear(), showDate.getMonth(), showDate.getDate())
|
||||||
|
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
today.setHours(0, 0, 0, 0)
|
const todayNormalized = new Date(today.getFullYear(), today.getMonth(), today.getDate())
|
||||||
const tomorrow = new Date(today)
|
|
||||||
tomorrow.setDate(tomorrow.getDate() + 1)
|
const tomorrowNormalized = new Date(todayNormalized)
|
||||||
|
tomorrowNormalized.setDate(tomorrowNormalized.getDate() + 1)
|
||||||
|
|
||||||
|
// Не показываем текст если дата равна сегодня
|
||||||
|
if (showDateNormalized.getTime() === todayNormalized.getTime()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
let dateText
|
let dateText
|
||||||
if (showDate.getTime() === today.getTime()) {
|
if (showDateNormalized.getTime() === tomorrowNormalized.getTime()) {
|
||||||
dateText = 'Сегодня'
|
|
||||||
} else if (showDate.getTime() === tomorrow.getTime()) {
|
|
||||||
dateText = 'Завтра'
|
dateText = 'Завтра'
|
||||||
} else {
|
} else {
|
||||||
dateText = showDate.toLocaleDateString('ru-RU', { day: 'numeric', month: 'long', year: 'numeric' })
|
dateText = showDate.toLocaleDateString('ru-RU', { day: 'numeric', month: 'long', year: 'numeric' })
|
||||||
|
|||||||
Reference in New Issue
Block a user