Skip to content

PATCH : changed title in issues and PRs #228

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 3 commits into
base: master
Choose a base branch
from

Conversation

vedansh-5
Copy link
Contributor

@vedansh-5 vedansh-5 commented Aug 5, 2025

📌 Fixes

Fixes #227
Fixes #217

As we discussed in our weekly scrum meeting to have the title of issues and PRs changed to updated instead of made/ opened. This PR changes the code responsible for the same.


📝 Summary of Changes

Here I have changed the logic to display Opened Issue and Made PR when the respective are created today, if we generate the scrum report for a week in which the issues and PRs were made they would still display updated in their title as they were created on some other date.


📸 Screenshots / Demo (if UI-related)

image

✅ Checklist

  • I’ve tested my changes locally
  • I’ve added tests (if applicable)
  • I’ve updated documentation (if applicable)
  • My code follows the project’s code style guidelines

👀 Reviewer Notes

Add any special notes for the reviewer here

Summary by Sourcery

Revise the action labels for issues and pull/merge requests to differentiate between items created today and those updated in the report period.

Enhancements:

  • Use item.created_at to detect if an issue or PR was opened today and label it 'Opened Issue'/'Made PR' accordingly.
  • Replace generic 'Existing' labels with 'Updated Issue'/'Updated PR'/'Updated Merge Request' for updated items.

Signed-off-by: Vedansh Saini <[email protected]>
@github-actions github-actions bot added javascript Pull requests that update javascript code core labels Aug 5, 2025
Copy link
Contributor

sourcery-ai bot commented Aug 5, 2025

Reviewer's Guide

This PR refactors the date-based logic in scrumHelper.js to correctly distinguish items created today from those updated within the reporting period. It introduces a normalized “isCreatedToday” flag and updates the PR and issue action labels accordingly, replacing stale ‘Existing/Made/Open’ terms with dynamic ‘Updated’ or ‘Made/Open’ based on creation date.

Class diagram for scrumHelper.js issue and PR label logic update

classDiagram
    class ScrumHelper {
      +generateScrumReport()
      +isCreatedToday(item: Object): Boolean
    }
    class Item {
      +created_at: Date
      +updated_at: Date
      +state: String
      +state_reason: String
    }
    ScrumHelper --|> Item : uses
    ScrumHelper : +"if isCreatedToday(item) => 'Opened Issue'/'Made PR'"
    ScrumHelper : +"else => 'Updated Issue'/'Updated PR'"
Loading

File-Level Changes

Change Details Files
Introduce normalized date check to identify items created today
  • Add date normalization block (set hours to zero) and compute isCreatedToday before PR logic
  • Add equivalent date normalization and isCreatedToday computation before issue logic
src/scripts/scrumHelper.js
Update pull request action determination
  • Fix isNewPR comparison to use normalized date flag instead of direct new Date() equality
  • Change PR label from 'Existing PR' to 'Updated PR' when not created today
  • Change Merge Request label from 'Existing Merge Request' to 'Updated Merge Request'
src/scripts/scrumHelper.js
Replace hardcoded 'Opened Issue' with dynamic issueActionText
  • Declare issueActionText based on isCreatedToday
  • Use issueActionText in templates for open issues, closed issues (all state_reasons), and fallback
src/scripts/scrumHelper.js

Possibly linked issues

  • Added cross-browser compatibility for gekko and blink based browsers #123: The PR implements the logic to display 'Updated Issue' when an issue is not created today, fulfilling the issue's request to change the label from 'Opened Issues' to 'Updated Issues' based on its state/update.
  • #0: PR implements logic to display 'Updated PRs' and 'Updated Issues' based on creation date, as proposed.

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

@vedansh-5 vedansh-5 requested review from hpdang and Preeti9764 August 5, 2025 17:11
@vedansh-5 vedansh-5 self-assigned this Aug 5, 2025
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 @vedansh-5 - I've reviewed your changes - here's some feedback:

  • The new isNewPR check (prCreatedDate == new Date()) will always be false – switch back to a proper date-range filter or normalize and compare only the date parts.
  • You have the same logic for zeroing out hours and checking isCreatedToday in two places – extract that into a helper function to avoid duplication.
  • Right now closed issues still use issueActionText based on creation date; it might be clearer to use a distinct "Closed Issue" label instead of reusing the opened/updated logic.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `isNewPR` check (`prCreatedDate == new Date()`) will always be false – switch back to a proper date-range filter or normalize and compare only the date parts.
- You have the same logic for zeroing out hours and checking `isCreatedToday` in two places – extract that into a helper function to avoid duplication.
- Right now closed issues still use `issueActionText` based on creation date; it might be clearer to use a distinct "Closed Issue" label instead of reusing the opened/updated logic.

## Individual Comments

### Comment 1
<location> `src/scripts/scrumHelper.js:1427` </location>
<code_context>
+                const isCreatedToday = today.getTime() === itemCreatedDate.getTime();

-                const isNewPR = prCreatedDate >= startDateFilter && prCreatedDate <= endDateFilter;
+                const isNewPR = prCreatedDate == new Date();
                 const prUpdatedDate = new Date(item.updated_at);
                 const isUpdatedInRange = prUpdatedDate >= startDateFilter && prUpdatedDate <= endDateFilter;
</code_context>

<issue_to_address>
Direct comparison of Date objects may not work as intended.

Use getTime() to compare the numeric values of the dates, or normalize both dates before comparison to ensure accurate value equality.
</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.

Signed-off-by: Vedansh Saini <[email protected]>
@hpdang
Copy link
Member

hpdang commented Aug 8, 2025

@vedansh-5 I tested this but there was a mismatch between my Compose Window and the Scrum Generation, please see screenshot

@hpdang
Copy link
Member

hpdang commented Aug 8, 2025

Screenshot from 2025-08-08 06-55-31

@hpdang
Copy link
Member

hpdang commented Aug 8, 2025

@Preeti9764 can you plz review this?

@Preeti9764
Copy link
Contributor

for me mismatch issue is not there but,
image
Screenshot 2025-08-09 155926
after pr get merged it showing made pr text .

@vedansh-5
Copy link
Contributor Author

for me mismatch issue is not there but, image Screenshot 2025-08-09 155926 after pr get merged it showing made pr text .

image Fixed this.

@vedansh-5
Copy link
Contributor Author

Screenshot from 2025-08-08 06-55-31
image

I could not replicate it,

Signed-off-by: Vedansh Saini <[email protected]>
@vedansh-5
Copy link
Contributor Author

@Preeti9764 @hpdang Please review, thankyou

@hpdang
Copy link
Member

hpdang commented Aug 11, 2025

@Preeti9764 could you please review this?

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