Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions internal/bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func (b *Bot) handleMessage(message *tgbotapi.Message) {
// Handle commands
if message.IsCommand() {
switch message.Command() {
case "submit":
b.handleSubmitCommand(message)
// case "submit":
// b.handleSubmitCommand(message)
case "leaderboards":
b.handleLeaderboardCommand(message)
case "help":
Expand Down Expand Up @@ -493,6 +493,16 @@ func (b *Bot) CheckSubmissions() error {
} else {
mention = user.FirstName
}
submission := &models.Submission{
UserID: user.ID,
ProblemID: todaysChallenge.ID,
Date: today,
}
err = b.db.AddSubmission(submission)
if err != nil {
log.Printf("Error adding submission for user %d: %v", user.ID, err)
continue
}

messageText := fmt.Sprintf("🎉 %s has just submitted today's challenge (Day %d):\n\n", mention, dayNumber)

Expand Down
2 changes: 1 addition & 1 deletion internal/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func (db *DB) GetLeetcodeProfile(id int64) (*models.User, error) {

if rows.Next() {
var user models.User
err := rows.Scan(&user.ID, &user.Username, &user.FirstName, &user.LastName)
err := rows.Scan(&user.ID, &user.Username)
if err != nil {
return nil, err
}
Expand Down
Loading