Skip to content

Conversation

igennova
Copy link
Contributor

@igennova igennova commented Aug 28, 2025

fixes : #4517
image

Summary by CodeRabbit

  • New Features
    • Lab detail page now highlights your completed tasks with a green “Completed” badge and checkmark, making progress easier to track at a glance.
    • Completion status is personalized per user and shown directly within the task list; unfinished tasks remain unchanged for clear differentiation.

Copy link
Contributor

coderabbitai bot commented Aug 28, 2025

Walkthrough

Adds 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

Cohort / File(s) Summary
Settings tuple normalization
blt/settings.py
In DEBUG, changes middleware append from list literal to one-element tuple: MIDDLEWARE += ("livereload.middleware.LiveReloadScript",)
Lab detail template badges
website/templates/lab_detail.html
Adds conditional “Completed” badge next to task type badge when task.id is in completed_task_ids
View: compute completion set
website/views/Simulation.py
In lab_detail, queries UserTaskProgress for current user’s completed tasks in the lab, builds completed_task_ids set, and passes it to template context

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
Loading

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@DonnieBLT DonnieBLT enabled auto-merge August 28, 2025 16:20
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 installed

Keep 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 tasks

Using 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/accessibility

Switch 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

📥 Commits

Reviewing files that changed from the base of the PR and between 91d857d and ffe9ea4.

📒 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 LGTM

Passing completed_task_ids to the template is correct and matches the template usage.

@DonnieBLT DonnieBLT added this pull request to the merge queue Aug 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 28, 2025
@igennova igennova requested a review from DonnieBLT August 28, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Completed Badge on Task
2 participants