Skip to content

Conversation

@priscilawebdev
Copy link
Member

@linear
Copy link

linear bot commented Nov 5, 2025

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 5, 2025
@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #102762   +/-   ##
========================================
  Coverage   80.92%    80.92%           
========================================
  Files        8931      8931           
  Lines      391099    391096    -3     
  Branches    24863     24862    -1     
========================================
- Hits       316485    316483    -2     
+ Misses      74246     74245    -1     
  Partials      368       368           

Comment on lines 304 to 364
{"by": {}, "series": {"sum(quantity)": [0, 8]}, "totals": {"sum(quantity)": 8}}
],
"start": isoformat_z(floor_to_utc_day(self._now) - timedelta(days=1)),
"end": isoformat_z(floor_to_utc_day(self._now) + timedelta(days=1)),
}

response = self.do_request(
{
"project": [-1],
"statsPeriod": "1d",
"interval": "6h",
"field": ["sum(quantity)"],
"category": ["error"],
},
status_code=200,
)

assert result_sorted(response.data) == {
"intervals": [
isoformat_z((self._now - timedelta(days=1)).replace(hour=12, minute=0, second=0)),
isoformat_z((self._now - timedelta(days=1)).replace(hour=18, minute=0, second=0)),
isoformat_z(self._now.replace(hour=0, minute=0, second=0)),
isoformat_z(self._now.replace(hour=6, minute=0, second=0)),
isoformat_z(self._now.replace(hour=12, minute=0, second=0)),
],
"groups": [
{
"by": {},
"series": {"sum(quantity)": [0, 0, 0, 6, 0]},
"totals": {"sum(quantity)": 6},
"series": {"sum(quantity)": [0, 0, 0, 8, 0]},
"totals": {"sum(quantity)": 8},
}
],
"start": isoformat_z(
self._now.replace(hour=12, minute=0, second=0) - timedelta(days=1)
),
"end": isoformat_z(self._now.replace(hour=18, minute=0, second=0)),
}

@freeze_time(_now)
def test_user_org_total_all_accessible(self) -> None:
response = self.do_request(
{
"project": [-1],
"statsPeriod": "1d",
"interval": "1d",
"field": ["sum(quantity)"],
"category": ["error", "transaction"],
},
user=self.user2,
status_code=200,
)

assert result_sorted(response.data) == {
"start": isoformat_z(floor_to_utc_day(self._now) - timedelta(days=1)),
"end": isoformat_z(floor_to_utc_day(self._now) + timedelta(days=1)),
"intervals": [
isoformat_z(floor_to_utc_day(self._now) - timedelta(days=1)),
isoformat_z(floor_to_utc_day(self._now)),
],
"groups": [
{"by": {}, "series": {"sum(quantity)": [0, 7]}, "totals": {"sum(quantity)": 7}}
{"by": {}, "series": {"sum(quantity)": [0, 9]}, "totals": {"sum(quantity)": 9}}
Copy link
Member Author

Choose a reason for hiding this comment

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

this is because of the new added outcome

Comment on lines +470 to +473
{
"by": {"project": self.project5.id},
"totals": {"sum(quantity)": 2},
},
Copy link
Member Author

Choose a reason for hiding this comment

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

[
not project_ids or project_ids == ALL_ACCESS_PROJECTS,
# ALL_ACCESS_PROJECTS ({-1}) signals that stats should aggregate across
# all projects rather than filtering to specific project IDs
Copy link
Contributor

Choose a reason for hiding this comment

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

I would really replace this with an if-statement with the two conditions anded together.

Comment on lines 232 to 239
return all(
[
not project_ids or project_ids == ALL_ACCESS_PROJECTS,
# ALL_ACCESS_PROJECTS ({-1}) signals that stats should aggregate across
# all projects rather than filtering to specific project IDs
project_ids == ALL_ACCESS_PROJECTS,
"project" not in request.GET.get("groupBy", []),
]
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return all(
[
not project_ids or project_ids == ALL_ACCESS_PROJECTS,
# ALL_ACCESS_PROJECTS ({-1}) signals that stats should aggregate across
# all projects rather than filtering to specific project IDs
project_ids == ALL_ACCESS_PROJECTS,
"project" not in request.GET.get("groupBy", []),
]
)
return (
# ALL_ACCESS_PROJECTS ({-1}) signals that stats should aggregate across
# all projects rather than filtering to specific project IDs
project_ids == ALL_ACCESS_PROJECTS
and "project" not in request.GET.get("groupBy", [])
)

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@priscilawebdev priscilawebdev marked this pull request as ready for review November 5, 2025 11:11
@priscilawebdev priscilawebdev requested review from a team as code owners November 5, 2025 11:11
@priscilawebdev priscilawebdev merged commit 6982620 into master Nov 5, 2025
69 checks passed
@priscilawebdev priscilawebdev deleted the priscila/fix/orgstats/fix-query-project-parameter-filter-logic branch November 5, 2025 11:14
@sentry
Copy link

sentry bot commented Nov 5, 2025

Issues attributed to commits in this pull request

This pull request was merged and Sentry observed the following issues:

@priscilawebdev priscilawebdev added the Trigger: Revert Add to a merged PR to revert it (skips CI) label Nov 5, 2025
@getsentry-bot
Copy link
Contributor

PR reverted: 574cda2

getsentry-bot added a commit that referenced this pull request Nov 5, 2025
…s project (#102762)"

This reverts commit 6982620.

Co-authored-by: priscilawebdev <29228205+priscilawebdev@users.noreply.github.com>
priscilawebdev added a commit that referenced this pull request Nov 6, 2025
…s project (#102762)"

This reverts commit 6982620.

Co-authored-by: priscilawebdev <29228205+priscilawebdev@users.noreply.github.com>
Jesse-Box pushed a commit that referenced this pull request Nov 12, 2025
…s project (#102762)"

This reverts commit 6982620.

Co-authored-by: priscilawebdev <29228205+priscilawebdev@users.noreply.github.com>
andrewshie-sentry pushed a commit that referenced this pull request Nov 13, 2025
…s project (#102762)"

This reverts commit 6982620.

Co-authored-by: priscilawebdev <29228205+priscilawebdev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components Trigger: Revert Add to a merged PR to revert it (skips CI)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants