Skip to content

Commit a36e47f

Browse files
committed
feat: remove shuruq from jamaat
1 parent 5af98b7 commit a36e47f

File tree

20 files changed

+51
-55
lines changed

20 files changed

+51
-55
lines changed

_scripts/migrate/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
// Domain types matching the new schema
2525
type JamaatDelayConfig struct {
2626
Fajr int64 `json:"fajr"` // nanoseconds
27-
Shuruq int64 `json:"shuruq"` // nanoseconds
2827
Dhuhr int64 `json:"dhuhr"` // nanoseconds
2928
Asr int64 `json:"asr"` // nanoseconds
3029
Maghrib int64 `json:"maghrib"` // nanoseconds
@@ -233,7 +232,6 @@ func transformChat(oldChat OldChat, moscowLocation *time.Location) (NewChat, err
233232
Enabled: subscribed && jamaat,
234233
Delay: &JamaatDelayConfig{
235234
Fajr: int64(10 * time.Minute),
236-
Shuruq: int64(10 * time.Minute),
237235
Dhuhr: int64(10 * time.Minute),
238236
Asr: int64(10 * time.Minute),
239237
Maghrib: int64(10 * time.Minute),

serverless/dispatcher/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/escalopa/prayer-bot/dispatcher
33
go 1.21
44

55
require (
6-
github.com/escalopa/prayer-bot v0.0.0-20251026211435-73f9e46a72f7
6+
github.com/escalopa/prayer-bot v0.0.0-20251026213512-5af98b73d4ad
77
github.com/go-telegram/bot v1.15.0
88
github.com/ydb-platform/ydb-go-genproto v0.0.0-20241112172322-ea1f63298f77
99
github.com/ydb-platform/ydb-go-sdk/v3 v3.108.0

serverless/dispatcher/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,8 @@ github.com/escalopa/prayer-bot v0.0.0-20251026205320-11cb2dcd014e h1:rnAVK8yqKdv
587587
github.com/escalopa/prayer-bot v0.0.0-20251026205320-11cb2dcd014e/go.mod h1:HOpIxziLKMTC/a+Q6z40Rn5tJDEZsFyzhniLA4iB2i0=
588588
github.com/escalopa/prayer-bot v0.0.0-20251026211435-73f9e46a72f7 h1:DO0ejIbuZJJxoxareSryEpp1HGNHRDzCkNUtKwlvhFg=
589589
github.com/escalopa/prayer-bot v0.0.0-20251026211435-73f9e46a72f7/go.mod h1:HOpIxziLKMTC/a+Q6z40Rn5tJDEZsFyzhniLA4iB2i0=
590+
github.com/escalopa/prayer-bot v0.0.0-20251026213512-5af98b73d4ad h1:bWmc3gk++my6XDOXRQKfER/xmXkl70Yobw2nQQdcroY=
591+
github.com/escalopa/prayer-bot v0.0.0-20251026213512-5af98b73d4ad/go.mod h1:HOpIxziLKMTC/a+Q6z40Rn5tJDEZsFyzhniLA4iB2i0=
590592
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
591593
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
592594
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=

serverless/dispatcher/internal/handler/command.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ func (h *Handler) info(ctx context.Context, b *bot.Bot, _ *models.Update) error
312312
jamaatInfo = fmt.Sprintf(text.Info.Jamaat,
313313
jamaatStatus,
314314
domain.FormatDuration(chat.Reminder.Jamaat.Delay.Fajr),
315-
domain.FormatDuration(chat.Reminder.Jamaat.Delay.Shuruq),
316315
domain.FormatDuration(chat.Reminder.Jamaat.Delay.Dhuhr),
317316
domain.FormatDuration(chat.Reminder.Jamaat.Delay.Asr),
318317
domain.FormatDuration(chat.Reminder.Jamaat.Delay.Maghrib),

serverless/dispatcher/internal/handler/handler.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ func (h *Handler) getChat(ctx context.Context, update *models.Update) (*domain.C
253253
Jamaat: &domain.JamaatConfig{
254254
Delay: &domain.JamaatDelayConfig{
255255
Fajr: 10 * time.Minute,
256-
Shuruq: 10 * time.Minute,
257256
Dhuhr: 10 * time.Minute,
258257
Asr: 10 * time.Minute,
259258
Maghrib: 10 * time.Minute,

serverless/dispatcher/internal/handler/keyboard.go

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,15 @@ func (h *Handler) remindEditKeyboard(reminderType domain.ReminderType, languageC
167167
func (h *Handler) jammatMenuKeyboard(chat *domain.Chat) *models.InlineKeyboardMarkup {
168168
text := h.lp.GetText(chat.LanguageCode)
169169

170-
kb := &models.InlineKeyboardMarkup{InlineKeyboard: make([][]models.InlineKeyboardButton, 5)}
170+
prayerIDs := []domain.PrayerID{
171+
domain.PrayerIDFajr,
172+
domain.PrayerIDDhuhr,
173+
domain.PrayerIDAsr,
174+
domain.PrayerIDMaghrib,
175+
domain.PrayerIDIsha,
176+
}
177+
178+
kb := &models.InlineKeyboardMarkup{InlineKeyboard: make([][]models.InlineKeyboardButton, len(prayerIDs)+2)}
171179

172180
if chat.Reminder.Jamaat.Enabled {
173181
kb.InlineKeyboard[0] = []models.InlineKeyboardButton{
@@ -179,28 +187,17 @@ func (h *Handler) jammatMenuKeyboard(chat *domain.Chat) *models.InlineKeyboardMa
179187
}
180188
}
181189

182-
fajrDelay := domain.FormatDuration(chat.Reminder.Jamaat.Delay.Fajr)
183-
shuruqDelay := domain.FormatDuration(chat.Reminder.Jamaat.Delay.Shuruq)
184-
kb.InlineKeyboard[1] = []models.InlineKeyboardButton{
185-
{Text: fmt.Sprintf("%s (%s)", text.Prayer[int(domain.PrayerIDFajr)], fajrDelay), CallbackData: "remind:jamaat:edit:fajr|"},
186-
{Text: fmt.Sprintf("%s (%s)", text.Prayer[int(domain.PrayerIDShuruq)], shuruqDelay), CallbackData: "remind:jamaat:edit:shuruq|"},
187-
}
188-
189-
dhuhrDelay := domain.FormatDuration(chat.Reminder.Jamaat.Delay.Dhuhr)
190-
asrDelay := domain.FormatDuration(chat.Reminder.Jamaat.Delay.Asr)
191-
kb.InlineKeyboard[2] = []models.InlineKeyboardButton{
192-
{Text: fmt.Sprintf("%s (%s)", text.Prayer[int(domain.PrayerIDDhuhr)], dhuhrDelay), CallbackData: "remind:jamaat:edit:dhuhr|"},
193-
{Text: fmt.Sprintf("%s (%s)", text.Prayer[int(domain.PrayerIDAsr)], asrDelay), CallbackData: "remind:jamaat:edit:asr|"},
194-
}
195-
196-
maghribDelay := domain.FormatDuration(chat.Reminder.Jamaat.Delay.Maghrib)
197-
ishaDelay := domain.FormatDuration(chat.Reminder.Jamaat.Delay.Isha)
198-
kb.InlineKeyboard[3] = []models.InlineKeyboardButton{
199-
{Text: fmt.Sprintf("%s (%s)", text.Prayer[int(domain.PrayerIDMaghrib)], maghribDelay), CallbackData: "remind:jamaat:edit:maghrib|"},
200-
{Text: fmt.Sprintf("%s (%s)", text.Prayer[int(domain.PrayerIDIsha)], ishaDelay), CallbackData: "remind:jamaat:edit:isha|"},
190+
for i, prayerID := range prayerIDs {
191+
delay := chat.Reminder.Jamaat.Delay.GetDelayByPrayerID(prayerID)
192+
kb.InlineKeyboard[i+1] = []models.InlineKeyboardButton{
193+
{
194+
Text: fmt.Sprintf("%s (%s)", text.Prayer[int(prayerID)], domain.FormatDuration(delay)),
195+
CallbackData: fmt.Sprintf("remind:jamaat:edit:%s|", prayerID.String()),
196+
},
197+
}
201198
}
202199

203-
kb.InlineKeyboard[4] = []models.InlineKeyboardButton{
200+
kb.InlineKeyboard[len(prayerIDs)+1] = []models.InlineKeyboardButton{
204201
{Text: buttonBack, CallbackData: "remind:back:menu|"},
205202
}
206203

serverless/dispatcher/internal/handler/languages/ar.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ info:
117117
🕌 *إعدادات الجماعة:*
118118
الحالة: %s
119119
• الفجر: %s
120-
• الشروق: %s
121120
• الظهر: %s
122121
• العصر: %s
123122
• المغرب: %s

serverless/dispatcher/internal/handler/languages/en.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ info:
117117
🕌 *Jamaat Settings:*
118118
Status: %s
119119
• Fajr: %s
120-
• Shuruq: %s
121120
• Dhuhr: %s
122121
• Asr: %s
123122
• Maghrib: %s

serverless/dispatcher/internal/handler/languages/es.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ info:
117117
🕌 *Configuración de Jamaat:*
118118
Estado: %s
119119
• Fajr: %s
120-
• Shuruq: %s
121120
• Dhuhr: %s
122121
• Asr: %s
123122
• Maghrib: %s

serverless/dispatcher/internal/handler/languages/fr.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ info:
117117
🕌 *Paramètres Jamaat:*
118118
Statut: %s
119119
• Fajr: %s
120-
• Chourouq: %s
121120
• Dhuhr: %s
122121
• Asr: %s
123122
• Maghrib: %s

0 commit comments

Comments
 (0)