Skip to content

Fixing -closed -label- issue #207

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

manhuu14
Copy link

@manhuu14 manhuu14 commented Jul 18, 2025

Fixes #178 — Closed label is visible for merged PRs in reviewed section.

Fixed incorrect status labeling in the reviewed PRs section.

Added logic to display only the "open" label for open PRs.

Prevented display of the "closed" label for merged PRs.

Ensured merged PRs are not mislabeled as closed.
📸 Screenshots
before:-
Screenshot From 2025-07-14 19-51-16
after:-
Screenshot From 2025-07-18 22-24-44

Summary by Sourcery

Fix status labeling in reviewed PRs by only displaying open labels for open pull requests and hiding closed labels for merged or closed PRs, and streamline the rendering logic.

Bug Fixes:

  • Hide "closed" label on merged pull requests
  • Only show the "open" label for open pull requests

Enhancements:

  • Refactor pull request rendering into a clear if-else structure and remove redundant code
  • Add debug logging for commit rendering and merged/closed PR handling
  • Simplify date-range filtering logic

Copy link
Contributor

sourcery-ai bot commented Jul 18, 2025

Reviewer's Guide

This PR refactors the ScrumHelper script to correct PR status labeling by removing closed/draft icons from the reviewed section, streamlining the PR processing loop with template literals, and introducing logic to suppress labels for both merged and closed PRs.

Flow diagram for PR status label rendering logic (after fix)

flowchart TD
    A[Start PR rendering] --> B{Is PR a draft?}
    B -- Yes --> C[Show draft label]
    B -- No --> D{Is PR open?}
    D -- Yes --> E[Show open label]
    D -- No --> F{Is PR closed?}
    F -- Yes --> G{Is PR merged?}
    G -- Yes --> H[Show no label]
    G -- No --> I[Show no label]
    F -- No --> J[Show no label]
Loading

File-Level Changes

Change Details Files
Remove incorrect closed/draft icons in reviewed section
  • Commented out legacy closed‐label assignments
  • Replaced one closed‐button branch with draft‐button placeholder
src/scripts/scrumHelper.js
Refactor PR processing loop
  • Flattened nested blocks and hoisted variable declarations
  • Unified date‐range filtering and HTML construction using template literals
  • Replaced manual string concatenation with cleaner continue‐based flow
src/scripts/scrumHelper.js
Suppress labels for merged and closed PRs
  • Detect merged PRs via merged_at and suppress any status icon
  • Log merged vs. closed events instead of rendering labels
src/scripts/scrumHelper.js
Simplify issue handling
  • Removed closed‐label rendering for issues
  • Retained only the open label and work-on-issue logic
src/scripts/scrumHelper.js
Add placeholder scrum_helper file
  • Introduce new empty helper script
b/scrum_helper

Assessment against linked issues

Issue Objective Addressed Explanation
#178 Show 'Merged' label only for actually merged PRs in the reviewed section.
#178 Show 'Closed' label only for confirmed unmerged PRs in the reviewed section.
#178 Refactor status logic to improve clarity and handling of PR review status labeling.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @manhuu14 - I've reviewed your changes - here's some feedback:

  • Consider extracting the large PR/issue rendering loop into smaller helper functions to reduce duplication and make the flow easier to follow.
  • Clean up the leftover commented-out branches (e.g. old closed/draft label logic) to keep the code tidy and avoid confusion.
  • Replace or remove the console.log debug statements in favor of a consistent logging utility or eliminate them once validation is complete.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting the large PR/issue rendering loop into smaller helper functions to reduce duplication and make the flow easier to follow.
- Clean up the leftover commented-out branches (e.g. old closed/draft label logic) to keep the code tidy and avoid confusion.
- Replace or remove the console.log debug statements in favor of a consistent logging utility or eliminate them once validation is complete.

## Individual Comments

### Comment 1
<location> `src/scripts/scrumHelper.js:1026` </location>
<code_context>
-                        '&nbsp;&nbsp;</li>';
-                    nextWeekArray.push(li2);
-                }
-                if (item.state === 'open') {
-                    li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_opened_button}</li>`;
-                } else if (item.state === 'closed') {
-                    li = `<li><i>(${project})</i> - Opened Issue(#${number}) - <a href='${html_url}'>${title}</a> ${issue_closed_button}</li>`;
</code_context>

<issue_to_address>
Inconsistent use of target='_blank' in anchor tags.

Please standardize the use of `target='_blank'` for all external links to ensure consistent navigation behavior.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

manhuu14 and others added 4 commits July 18, 2025 22:59
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@manhuu14
Copy link
Author

@Preeti9764 can you review it.

@hpdang hpdang requested a review from Preeti9764 July 28, 2025 16:01
@github-actions github-actions bot added javascript Pull requests that update javascript code core labels Jul 29, 2025
@Preeti9764
Copy link
Contributor

@manhuu14 the preview report is not getting generated.Thanks!

@Preeti9764
Copy link
Contributor

Preeti9764 commented Jul 30, 2025

@hpdang Please look into this issue #176 I have checked for master branch and found we already have this behaviour currently so the issue is no more and can be closed as completed.

@manhuu14
Copy link
Author

Hi @Preeti9764, thank you for reviewing and pointing out the behavior regarding the preview report.

✔️ Based on your observation and the current state of the master branch, it seems the issue (Closed label on merged PRs in the reviewed section — #178) has already been addressed.

📝 In this PR, I had implemented:

Logic to suppress the "Closed" label for merged PRs.

Ensured only "Open" PRs show the correct label.

Refactored the rendering logic with better structure and cleaner loops.

Added debug logs for clarity during development.

🛠️ If the fix is now already present in the master branch (as you mentioned), this PR might be considered redundant unless there are any additional improvements or cleanups you'd like me to retain (e.g., refactored rendering or suppressed redundant code blocks).

Please let me know if you'd like me to:

Close this PR,

Adjust it to keep only helpful refactor/cleanup,

Or if anything else is needed on my part.

Thanks again for your time and guidance!

@Preeti9764
Copy link
Contributor

📝 In this PR, I had implemented:

Logic to suppress the "Closed" label for merged PRs.

Ensured only "Open" PRs show the correct label.

@manhuu14 this is not required as far as i have knowledge tagging @hpdang for her views.

Copy link
Contributor

@Preeti9764 Preeti9764 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need changes

@manhuu14
Copy link
Author

manhuu14 commented Aug 3, 2025

@Preeti9764 changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core javascript Pull requests that update javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants