Skip to content

Conversation

@zjsun
Copy link

@zjsun zjsun commented Jan 5, 2021

What type of PR is this? (check all applicable)

  • Feature

Description

Support quarterly interval in cohort #4269

Related Tickets & Documents

#4269

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

image

@zjsun
Copy link
Author

zjsun commented Jan 5, 2021

I'd never changed the source structure, only added some 'interval' related options like "quarterly" etc.

How could I pass the build and e2e-tests?

@zjsun zjsun changed the title quarterly interval in cohort #4269 Feature: quarterly interval in cohort #4269 Jan 5, 2021
@kravets-levko kravets-levko self-assigned this Jan 5, 2021
@kravets-levko
Copy link
Collaborator

How could I pass the build and e2e-tests?

You passed! 😅

@rafawendel
Copy link
Member

rafawendel commented Jan 5, 2021

Hi @zjsun thanks for your work here.

I took a look at the implementation of this feature and despite the categories showing up properly in the UI, the logic behind them seems to not work properly. That is, the quarters do not match with the monthly results. Please tell me if otherwise.

It is basically defined here (line 40 of prepareData.ts):

_.each(grouped, group => {
    if (previousDate !== null) {
      // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
      let diff = Math.abs(previousDate.diff(group.date, momentInterval[timeInterval]));
      while (diff > 1) {
        const row = [0];
        for (let stage = firstStage; stage <= lastStage; stage += 1) {
          // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
          row.push(group.values[stage] || 0);
        }
        data.push(row);
        // It should be diagonal, so decrease count of stages for each next row
        lastStage -= 1;
        diff -= 1;
      }
    }

I couldn't grasp immediately why it didn't work, so I can better investigate it soon, if you want to.

@zjsun
Copy link
Author

zjsun commented Jan 6, 2021

I took a look at the implementation of this feature and despite the categories showing up properly in the UI, the logic behind them seems to not work properly. That is, the quarters do not match with the monthly results. Please tell me if otherwise.

Thanks for your reviewing. @rafawendel

When using quarterly interval option, The cohort date in the query result is based on the rule which is based on the first day of the quarter(which is mentioned here ), eg. 2019-01-01, 2019-04-01, 2019-07-01 ... etc.

FYI.

Here is my query result:
result.json.zip

@Avey777
Copy link
Collaborator

Avey777 commented Jun 16, 2023

It is already difficult to merge the code here. You have another option available:
https://github.com/RedashCommunity/redash

@guidopetri
Copy link
Contributor

@zjsun , thanks for the PR! We've updated a lot of things now that we're Community-driven so - if you're still interested in getting this merged - would you mind rebasing off master to re-run the CI?

We're trying to clean up our PR todo list, so if you're not interested, that's fine - we'll close the PR in about a week if we don't hear back. If you're interested in reopening the PR afterwards, we would also very much welcome that.

@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Merging #5342 (5d39fcc) into master (4107265) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #5342   +/-   ##
=======================================
  Coverage   60.70%   60.70%           
=======================================
  Files         154      154           
  Lines       12624    12624           
  Branches     1716     1716           
=======================================
  Hits         7663     7663           
  Misses       4735     4735           
  Partials      226      226           

Copy link

@cubic-dev-ai cubic-dev-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.

1 issue found across 10 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="pyproject.toml">

<violation number="1" location="pyproject.toml:15">
P0: Security risk: Package source uses insecure HTTP instead of HTTPS. This exposes package downloads to man-in-the-middle attacks where malicious code could be injected. Use `https://mirrors.aliyun.com/pypi/simple/` instead.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.


[[tool.poetry.source]]
name = "mirrors"
url = "http://mirrors.aliyun.com/pypi/simple/"
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 1, 2026

Choose a reason for hiding this comment

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

P0: Security risk: Package source uses insecure HTTP instead of HTTPS. This exposes package downloads to man-in-the-middle attacks where malicious code could be injected. Use https://mirrors.aliyun.com/pypi/simple/ instead.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At pyproject.toml, line 15:

<comment>Security risk: Package source uses insecure HTTP instead of HTTPS. This exposes package downloads to man-in-the-middle attacks where malicious code could be injected. Use `https://mirrors.aliyun.com/pypi/simple/` instead.</comment>

<file context>
@@ -10,9 +10,14 @@ force-exclude = &#39;&#39;&#39;
 
+[[tool.poetry.source]]
+name = &quot;mirrors&quot;
+url = &quot;http://mirrors.aliyun.com/pypi/simple/&quot;
+priority = &quot;primary&quot;
+
</file context>
Suggested change
url = "http://mirrors.aliyun.com/pypi/simple/"
url = "https://mirrors.aliyun.com/pypi/simple/"
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants