Skip to content
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

[IMP] pivot: add support for date(time) measures #5302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LucasLefevre
Copy link
Collaborator

Task: 3989393

Description:

description of this task, what is implemented and why it is implemented that way.

Task: TASK_ID

review checklist

  • feature is organized in plugin, or UI components
  • support of duplicate sheet (deep copy)
  • in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • in model/UI: ranges are strings (to show the user)
  • undo-able commands (uses this.history.update)
  • multiuser-able commands (has inverse commands and transformations where needed)
  • new/updated/removed commands are documented
  • exportable in excel
  • translations (_t("qmsdf %s", abc))
  • unit tested
  • clean commented code
  • track breaking changes
  • doc is rebuild (npm run doc)
  • status is correct in Odoo

@robodoo
Copy link
Collaborator

robodoo commented Dec 3, 2024

Pull request status dashboard

@LucasLefevre LucasLefevre force-pushed the master-pivot-date-measure-lul branch from 2b63f23 to 1929040 Compare December 4, 2024 13:34
Copy link
Contributor

@hokolomopo hokolomopo left a comment

Choose a reason for hiding this comment

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

tchou tchou 🚂

@@ -42,6 +42,7 @@ const AGGREGATORS_BY_FIELD_TYPE = {
integer: NUMBER_CHAR_AGGREGATORS,
char: NUMBER_CHAR_AGGREGATORS,
boolean: ["count_distinct", "count", "bool_and", "bool_or"],
datetime: ["max", "min", "count_distinct", "count"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Can "average" aggregator make sense for dates in some cases ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I couldn't think of a use-case. But if you have an idea, we can add it

Copy link
Contributor

Choose a reason for hiding this comment

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

Mmmh if our Duration time format is included in this, both sum and average make sense.

Otherwise I'm not sure, but there'll probably be some Argentinan dude that might use it in his specific and niche use case. If it's free to add, why not add it 🤷

@@ -55,6 +55,6 @@ pivotRegistry.add("SPREADSHEET", {
onIterationEndEvaluation: (pivot: SpreadsheetPivot) => pivot.markAsDirtyForEvaluation(),
dateGranularities: [...dateGranularities],
datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
isMeasureCandidate: (field: PivotField) => !["datetime", "boolean"].includes(field.type),
isMeasureCandidate: (field: PivotField) => field.type !== "boolean",
Copy link
Contributor

@hokolomopo hokolomopo Dec 10, 2024

Choose a reason for hiding this comment

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

Is the next step also allowing boolean measures ? Or is there a specific reasons they don't work ?

And my next question: if we also allow boolean measures, do we want to enable drag & drop accros cols/row/measures ? With the special case of calculated measure

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

probably yes and yes

Comment on lines +1631 to +1632
{ id: "Date:max", fieldName: "Date", aggregator: "max" },
{ id: "Datetime:max", fieldName: "Datetime", aggregator: "max" },
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: could test differents aggregator rather than 2 max to be a bit more complete

With this commit, date and datetime fields are now supported as measures
for pivots.

Task: 3989393
@LucasLefevre LucasLefevre force-pushed the master-pivot-date-measure-lul branch from 1929040 to 6e7be0d Compare December 10, 2024 11:40
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.

3 participants