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

Improve spreadsheet import flow #839

Merged
merged 26 commits into from
Mar 22, 2024
Merged

Conversation

alex-Arc
Copy link
Collaborator

import

Copy link
Contributor

coderabbitai bot commented Mar 20, 2024

Important

Auto Review Skipped

Review was skipped due to path filters

Files ignored due to path filters (33)
  • apps/client/src/common/api/db.ts is excluded by: none and included by: none
  • apps/client/src/common/api/excel.ts is excluded by: none and included by: none
  • apps/client/src/common/api/sheets.ts is excluded by: none and included by: none
  • apps/client/src/common/utils/uploadUtils.ts is excluded by: none and included by: none
  • apps/client/src/features/app-settings/panel/sources-panel/GSheetSetup.tsx is excluded by: none and included by: none
  • apps/client/src/features/app-settings/panel/sources-panel/ImportReview.tsx is excluded by: none and included by: none
  • apps/client/src/features/app-settings/panel/sources-panel/SourcesPanel.tsx is excluded by: none and included by: none
  • apps/client/src/features/app-settings/panel/sources-panel/import-map/ImportMapForm.tsx is excluded by: none and included by: none
  • apps/client/src/features/app-settings/panel/sources-panel/useGoogleSheet.ts is excluded by: none and included by: none
  • apps/client/src/features/app-settings/panel/sources-panel/useSheetStore.ts is excluded by: none and included by: none
  • apps/server/src/api-data/db/db.controller.ts is excluded by: none and included by: none
  • apps/server/src/api-data/db/db.middleware.ts is excluded by: none and included by: none
  • apps/server/src/api-data/db/db.router.ts is excluded by: none and included by: none
  • apps/server/src/api-data/excel/excel.controller.ts is excluded by: none and included by: none
  • apps/server/src/api-data/excel/excel.middleware.ts is excluded by: none and included by: none
  • apps/server/src/api-data/excel/excel.router.ts is excluded by: none and included by: none
  • apps/server/src/api-data/excel/excel.service.ts is excluded by: none and included by: none
  • apps/server/src/api-data/excel/excel.validation.ts is excluded by: none and included by: none
  • apps/server/src/api-data/index.ts is excluded by: none and included by: none
  • apps/server/src/api-data/sheets/sheets.controller.ts is excluded by: none and included by: none
  • apps/server/src/api-data/sheets/sheets.router.ts is excluded by: none and included by: none
  • apps/server/src/api-data/sheets/sheets.validation.ts is excluded by: none and included by: none
  • apps/server/src/services/sheet-service/SheetService.ts is excluded by: none and included by: none
  • apps/server/src/services/sheet-service/__tests__/sheetUtils.test.ts is excluded by: none and included by: none
  • apps/server/src/services/sheet-service/sheetUtils.ts is excluded by: none and included by: none
  • apps/server/src/utils/__tests__/parser.test.ts is excluded by: none and included by: none
  • apps/server/src/utils/__tests__/time.test.ts is excluded by: none and included by: none
  • apps/server/src/utils/parser.ts is excluded by: none and included by: none
  • apps/server/src/utils/time.ts is excluded by: none and included by: none
  • e2e/tests/features/207-spreadsheet-import.spec.ts is excluded by: none and included by: none
  • e2e/tests/fixtures/test-sheet.xlsx is excluded by: none and included by: none
  • packages/utils/src/date-utils/isTimeString.test.ts is excluded by: none and included by: none
  • packages/utils/src/date-utils/isTimeString.ts is excluded by: none and included by: none

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Owner

@cpvalente cpvalente left a comment

Choose a reason for hiding this comment

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

remember to run fix the linter issues.
I am not sure about the structure here, I will take some time to look into it once we can merge

apps/client/src/common/api/db.ts Outdated Show resolved Hide resolved
Copy link
Owner

@cpvalente cpvalente left a comment

Choose a reason for hiding this comment

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

there is a lot of code here
I made a few suggestions for cleanup, lets start with those and I will look into the details more carefully after

packages/utils/src/date-utils/isTimeString.ts Show resolved Hide resolved
e2e/tests/features/207-spreadsheet-import.spec.ts Outdated Show resolved Hide resolved
apps/server/src/utils/time.ts Outdated Show resolved Hide resolved
apps/server/src/utils/parser.ts Outdated Show resolved Hide resolved
Copy link
Owner

@cpvalente cpvalente left a comment

Choose a reason for hiding this comment

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

🚀

@alex-Arc alex-Arc requested a review from cpvalente March 22, 2024 17:50
@alex-Arc
Copy link
Collaborator Author

if you have a chance to skim it that would be great
especially the new service file https://github.com/cpvalente/ontime/blob/improve-spreadsheet-import-flow/apps/server/src/api-data/excel/excel.service.ts

@alex-Arc

This comment was marked as resolved.

@@ -874,8 +874,8 @@ describe('parseExcel()', () => {
// TODO: update tests once import is resolved
Copy link
Owner

Choose a reason for hiding this comment

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

You can remove this todo now

@@ -192,10 +189,6 @@ export const parseExcel = (excelData: unknown[][], options?: Partial<ImportMap>)
}
} else if (j === titleIndex) {
event.title = makeString(column, '');
// if this is a block, we have nothing else to import
if (event.type === SupportedEvent.Block) {
Copy link
Owner

Choose a reason for hiding this comment

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

Question, can you give some background to the decision to remove this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah

it tried testing out what this skips, and calling continue in an exhaustive else if stack doesn't change anything
and as the type might not be the first thing found all the timer event fields will be added to a block event

so i added the clean up after https://github.com/cpvalente/ontime/pull/839/files/9b459c1fe43fe7359291a83f0f15907d06330d82#r1536170551

@@ -35,22 +35,40 @@ const parse = (valueAsString: string): number => {
return Math.abs(parsed);
};

const stripAMPM = (value: string) => {
Copy link
Owner

Choose a reason for hiding this comment

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

I think we have a function isAMPM that does some of this?

event.timerType = TimerType.CountDown;
event.type = SupportedEvent.Event;
// if it is a Block type drop all other filed
if (event.type === SupportedEvent.Block) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cleans up the block event

@alex-Arc alex-Arc merged commit f5e9a25 into v3 Mar 22, 2024
3 checks passed
@alex-Arc alex-Arc deleted the improve-spreadsheet-import-flow branch March 22, 2024 20:33
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.

None yet

2 participants