Discourse Daily Challenges

I am currently taking my daughter to school. And then I have a few appointments this morning. It will take me some time to investigate.

1 Like

It looks like some database columns may not have migrated properly. This version added several new columns to the existing tables. Can you try running:

cd /var/discourse && ./launcher rebuild app

Using the in-panel Update button doesn’t apply database migrations — a full rebuild is required when the plugin adds new columns.

Thanks for being patient. We’ll get it figured out!

1 Like

Actually, can you run this first and post the output?

./launcher enter app
su discourse -c 'cd /var/www/discourse && bundle exec rails runner "puts ActiveRecord::Base.connection.columns(\"daily_challenges\").map(&:name)"'
1 Like
root@segredin-app:/var/www/discourse# su discourse -c 'cd /var/www/discourse && bundle exec rails runner "puts ActiveRecord::Base.connection.columns(\"daily_challenges\").map(&:name)"'
id
topic_id
hashtag
start_date
end_date
check_ins_needed
description
created_at
updated_at
final_post_sent
weekly_post_enabled
weekly_post_day
weekly_post_hour
award_badge
badge_name
badge_id
check_in_interval
week_start
category_id

look this

ActiveModel::UnknownAttributeError (unknown attribute 'challenge_timezone' for DailyChallenge.) app/controllers/application_controller.rb:447:in 'block in ApplicationController#with_resolved_locale'

It looks like you are missing the challenge_timezone DB column. Can you run this:

./launcher enter app
su discourse -c 'cd /var/www/discourse && bundle exec rails runner "ActiveRecord::Base.connection.add_column(:daily_challenges, :challenge_timezone, :string, default: \"UTC\") unless ActiveRecord::Base.connection.column_exists?(:daily_challenges, :challenge_timezone)"'

That should add it. I will investigate why it didn’t get added and update files.

1 Like

Alright, remains but I’ll wait for his fix

ActiveModel::UnknownAttributeError (unknown attribute 'challenge_timezone' for DailyChallenge.)
app/controllers/application_controller.rb:447:in 'block in ApplicationController#with_resolved_locale'
app/controllers/application_controller.rb:447:in 'ApplicationController#with_resolved_locale'
app/controllers/application_controller.rb:1098:in 'ApplicationController#ensure_dont_cache_page'
lib/middleware/omniauth_bypass_middleware.rb:35:in 'Middleware::OmniauthBypassMiddleware#call'
lib/middleware/crawler_hooks.rb:11:in 'Middleware::CrawlerHooks#call'
lib/content_security_policy/middleware.rb:12:in 'ContentSecurityPolicy::Middleware#call'
lib/middleware/anonymous_cache.rb:420:in 'Middleware::AnonymousCache#call'
lib/middleware/csp_script_nonce_injector.rb:12:in 'Middleware::CspScriptNonceInjector#call'
config/initializers/008-rack-cors.rb:14:in 'Discourse::Cors#call'
lib/middleware/default_headers.rb:13:in 'Middleware::DefaultHeaders#call'
config/initializers/100-quiet_logger.rb:20:in 'DiscourseRackQuietAssetsLogger#call'
config/initializers/100-silence_logger.rb:29:in 'SilenceLogger#call'
lib/middleware/enforce_hostname.rb:23:in 'Middleware::EnforceHostname#call'
lib/middleware/request_tracker.rb:321:in 'Middleware::RequestTracker#call'
lib/middleware/overload_protections.rb:22:in 'Middleware::OverloadProtections#call'
lib/middleware/processing_request.rb:14:in 'Middleware::ProcessingRequest#call'

Just to make sure we are in the right directory, run this first:

cd /var/discourse && ./launcher enter app

Then run this:

su discourse -c 'cd /var/www/discourse && bundle exec rails runner "ActiveRecord::Base.connection.add_column(:daily_challenges, :challenge_timezone, :string, default: \"UTC\") unless ActiveRecord::Base.connection.column_exists?(:daily_challenges, :challenge_timezone)"'

After you rn that, you can type “exit” to get out of the app.

Do a hard refresh on the webpage (ctrl-shift-R) and try again. If that doesn;t work, I will be pushing a fix in a few.

I am in a meeting. I’ll update soon.

1 Like

I just pushed an update. You should be able to update via the admin panel. If that doesn’t work, you might have to do

./launcher rebuild app
1 Like

It Works

Friends: Chandler Bing (Matthew Perry) Dancing

1 Like

WOOOO!!! Thanks for sticking with me and helping me work through it!!

Funny Man Dancing in Tutu

1 Like

So next step have some new functions ahead? I wish to give you some ideas

Streaks with coins and badges and a place/section to follow up own stats

Anyway I love it and I waiting for more :smiley:

1 Like

I am currently working on this part. It will basically be a “bot” that you create (really just a user account). The plugin will watch for mentions of the bot. When it sees them, it will execute the action. For example:

Bot Name: ChallengeBot

Someone types:

@ChallengeBot status

The bot will send them a DM with their current status in the challenge.

The bot will also have some other options as well.

1 Like

Has how get this info to show it in another place ? or make it appear at card user? If have some path to do it would be nice

v1.4.0 is now available!

This release adds ChallengeBot — an optional bot account that brings DM-powered engagement features to your challenges.

New in this release:

  • Check-in confirmation DMs — members receive a DM from ChallengeBot after every successful check-in, showing their current streak and a link to the challenge topic.
  • Reminder DMs — participants who haven’t checked in for 2+ consecutive days (daily challenges) or haven’t checked in by the last day of the week (weekly challenges) receive a gentle nudge from ChallengeBot. Includes their current check-in count and goal. Toggle per challenge, defaults to enabled.
  • @mention commands — members can mention @ChallengeBot in any active challenge topic to get personal stats via DM. The bot never replies in the topic itself. Available commands: status, leaderboard, streak, checkins, progress, help. Rate limited to 10 commands per user per hour.
  • Leaderboard and final results posts — if ChallengeBot is configured, weekly leaderboard posts and final results posts are now sent from the bot account instead of the system account.
  • New site settingdaily_challenge_bot_username
  • New challenge field — reminder DMs toggle (defaults to enabled)

Setting up ChallengeBot is optional — all existing features continue to work without it. See the main post for full setup instructions.

Note: This release includes a database migration. The in-panel Update button will apply it automatically.

1 Like

Awesome :smiley:

This option its possible if send it to PM and at topic? I set @system as chatbot by the way

CSS

.daily-challenge-dashboard {
    background-color: #1a1a1b;
    padding: 20px;
    border-radius: 8px;
    color: #d7dadc;
}

.d-page-subheader__title {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 15px;
    border-bottom: 1px solid #343536;
    padding-bottom: 10px;
}

.d-stat-tiles.fcd-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.d-stat-tile {
    background-color: #272729;
    border: 1px solid #343536;
    padding: 15px;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.d-stat-tile:hover {
    border-color: #818384;
}

.d-stat-tile__label {
    color: #818384;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.d-stat-tile__value {
    display: block;
    font-size: 1.8rem;
    font-weight: 600;
    color: #ff4500;
}

.fcd-leaderboard__table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.fcd-leaderboard__table thead th {
    color: #818384;
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 0 15px 5px 15px;
    text-align: left;
}

.fcd-leaderboard__row {
    background-color: #272729;
    transition: transform 0.1s ease;
}

.fcd-leaderboard__row td {
    padding: 12px 15px;
    border-top: 1px solid #343536;
    border-bottom: 1px solid #343536;
}

.fcd-leaderboard__row td:first-child {
    border-left: 1px solid #343536;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.fcd-leaderboard__row td:last-child {
    border-right: 1px solid #343536;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.fcd-leaderboard__row:hover {
    background-color: #2d2d2e;
}

.fcd-rank {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.8rem;
}

.fcd-rank--gold { background: #ffd700; color: #000; box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
.fcd-rank--silver { background: #c0c0c0; color: #000; }

.fcd-streak-icon {
    color: #ff4500;
    filter: drop-shadow(0 0 3px rgba(255, 69, 0, 0.5));
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.fcd-progress {
    height: 8px;
    background-color: #343536;
    border-radius: 4px;
    overflow: hidden;
    width: 100px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.fcd-progress__bar {
    background: linear-gradient(90deg, #ff4500, #ff8c00);
    height: 100%;
    border-radius: 4px;
}

.fcd-progress__label {
    font-size: 0.8rem;
    color: #d7dadc;
    font-weight: bold;
}

.fcd-leaderboard__user img {
    border-radius: 50%;
    border: 2px solid #343536;
    margin-right: 10px;
}