-
-
Notifications
You must be signed in to change notification settings - Fork 226
(fix) docker image issue and completed enhancement in lab #4516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds per-user task completion indicators to the lab detail page by computing completed task IDs in the view and rendering a “Completed” badge in the template. Also normalizes middleware concatenation in settings by using a tuple instead of a list in DEBUG. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant View as lab_detail View
participant DB as UserTaskProgress Store
participant Tmpl as lab_detail Template
User->>View: GET /lab/<id> (authenticated)
View->>DB: Query completed progress for user and lab tasks
DB-->>View: Set of task IDs
View->>Tmpl: Render with context { completed_task_ids }
Tmpl-->>User: HTML with conditional "Completed" badges
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
blt/settings.py (1)
131-133
: Tuple append LGTM; add import guard to avoid DEBUG crashes when livereload isn’t installedKeep the tuple change. To prevent startup errors in Docker/dev environments lacking django-livereload-server, gate both app and middleware on importability.
# Replace the separate INSTALLED_APPS/MIDDLEWARE additions with this guarded block if DEBUG: try: import livereload # dev-only except ImportError: pass else: INSTALLED_APPS += ("livereload",) MIDDLEWARE += ("livereload.middleware.LiveReloadScript",)website/views/Simulation.py (1)
54-58
: Computation is correct; simplify the query to avoid subquery on tasksUsing task__lab_id is a bit leaner than task__in=tasks while preserving semantics.
- completed_task_ids = set( - UserTaskProgress.objects.filter(user=request.user, task__in=tasks, completed=True).values_list( - "task_id", flat=True - ) - ) + completed_task_ids = set( + UserTaskProgress.objects.filter( + user=request.user, + task__lab_id=lab_id, + task__is_active=True, + completed=True, + ).values_list("task_id", flat=True) + )website/templates/lab_detail.html (1)
92-99
: Badge works; prefer Tailwind palette, currentColor, and aria-hidden for consistency/accessibilitySwitch to framework colors and make the icon inherit text color.
- {% if completed_task_ids and task.id in completed_task_ids %} - <span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-[#2ecc71] text-[#000000]"> - <svg class="w-4 h-4 mr-1" fill="none" stroke="#27ae60" viewBox="0 0 24 24"> - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path> - </svg> - Completed - </span> - {% endif %} + {% if completed_task_ids and task.id in completed_task_ids %} + <span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800"> + <svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path> + </svg> + Completed + </span> + {% endif %}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting
📒 Files selected for processing (3)
blt/settings.py
(1 hunks)website/templates/lab_detail.html
(1 hunks)website/views/Simulation.py
(1 hunks)
⏰ 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: Run Tests
🔇 Additional comments (1)
website/views/Simulation.py (1)
63-64
: Context wiring LGTMPassing completed_task_ids to the template is correct and matches the template usage.
fixes : #4517

Summary by CodeRabbit