Improve the Seeding of sofia accounts#1201
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughSeed data updated: users replaced with explicit Dutch names (one with birthday); recent and historical activities added (with computed timestamps); credit mutations diversified and linked; Sofia accounts and roles created; orders seeded after activities; product seeds now include category-based color attributes. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)db/seeds.rb (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This pull request improves the seeding of Sofia accounts and other database seed data to provide more realistic test/development data. The changes add color coding to product categories, replace generic test data with Dutch names and activities, add historical activities, improve credit mutation variety, and introduce seeding for Sofia account users with specific roles.
Changes:
- Added color codes for product categories to visually distinguish different product types
- Replaced generic test data with realistic Dutch names, activity titles, and credit mutation descriptions
- Added seeding for Sofia accounts with specific roles (treasurer, main bartender, renting manager)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| db/seeds/products.rb | Added CATEGORY_COLORS constant and updated Product.create calls to include color assignments for better visual categorization |
| db/seeds.rb | Enhanced seed data with Dutch names, realistic activities (including historical ones), varied credit mutations, and Sofia account seeding for role-specific test users |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| activities << FactoryBot.create(:activity, title:, price_list: price_lists.sample, created_by: users.sample) | ||
| end | ||
|
|
||
| # Historische activiteiten (locked) |
There was a problem hiding this comment.
The comment says 'Historische activiteiten (locked)' but the code doesn't actually lock the activities. If locking is intended, you should add code to lock these activities after creation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## staging #1201 +/- ##
========================================
Coverage 77.68% 77.68%
========================================
Files 54 54
Lines 1340 1340
========================================
Hits 1041 1041
Misses 299 299 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @db/seeds.rb:
- Around line 104-121: The seeded password variable seed_password is fetched but
not used; replace the hardcoded 'password1234' literals passed to
SofiaAccount.create! for the users (treasurer_user, main_bartender_user,
renting_manager_user) with the seed_password variable so
SofiaAccount.create!(username: ..., password: seed_password, user: ...) is used
for each account; keep the ENV.fetch fallback as-is so devs can override via
SEED_PASSWORD.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
db/seeds.rbdb/seeds/products.rb
🧰 Additional context used
🧬 Code graph analysis (1)
db/seeds.rb (11)
app/models/role.rb (1)
name(8-16)app/models/invoice.rb (2)
name(15-17)amount(23-25)app/controllers/credit_mutations_controller.rb (1)
create(16-33)app/controllers/users_controller.rb (2)
create(74-85)activities(119-129)app/controllers/orders_controller.rb (1)
create(18-39)app/controllers/sofia_accounts_controller.rb (1)
create(12-30)app/controllers/payments_controller.rb (1)
create(10-23)app/controllers/products_controller.rb (1)
create(7-16)app/controllers/activities_controller.rb (1)
create(47-58)app/controllers/invoices_controller.rb (1)
create(29-41)app/controllers/price_lists_controller.rb (1)
create(23-33)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
🔇 Additional comments (6)
db/seeds/products.rb (2)
2-14: LGTM! Well-structured color mapping.The frozen hash with descriptive Dutch comments provides clear category-to-color associations. All product categories are covered.
28-66: Consistent color application across all product categories.The
color:attribute is correctly passed to allProduct.createcalls using the corresponding category key fromcategory_colors.db/seeds.rb (4)
14-30: LGTM! Good test data setup.The explicit Dutch names improve seed data readability. The underage user (16 years) is useful for testing age-restricted product scenarios.
33-59: LGTM! Historical activities with realistic timestamps.The time calculation correctly creates activities that started
days_agoand ended approximately 24 hours later. This provides good test data for historical/locked activities.
70-91: LGTM! Realistic credit mutation data.Good variation with different descriptions and amount ranges (including corrections that can be negative). The optional
nilactivity is appropriate for mutations not tied to specific activities.
108-109: No issues found. The:sofia_accounttrait only sets theproviderfield on the User model and does not create a SofiaAccount record. Line 109 correctly creates the actual SofiaAccount with specific credentials. TheSofiaAccountmodel validates uniqueness on the user association, preventing duplicates.Likely an incorrect or invalid review comment.
Improve the Seeding of sofia accounts and some other small parts
Fixes #1170
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.