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

חברה מפעילה input inconsistency #401

Closed
Haswell-s opened this issue Jan 17, 2024 · 7 comments
Closed

חברה מפעילה input inconsistency #401

Haswell-s opened this issue Jan 17, 2024 · 7 comments
Assignees
Labels
bug Something isn't working frontend frontend developers issue

Comments

@Haswell-s
Copy link
Collaborator

Haswell-s commented Jan 17, 2024

The fact that items are pre-selected creates inconsistensies between pages and does not reflect the db.
I would suggest to chnage the behavior of the component to fetch the db instead.

To make it faster I would say to cache the data from the landing page (קיום נסיעות) charts and use them as the options, but this is out of the scope of this issue.

Screenshot 2024-01-17 at 20 01 27 Screenshot 2024-01-17 at 20 02 14
@Haswell-s
Copy link
Collaborator Author

I want to discuss possible solutions, should I do it here or on slack?
After clarification you can assign me to this one!

@NoamGaash
Copy link
Member

@i5x64BIT could you please clarify and provide example for inconsistencies / false information?
This is the perfect place for discussing possible solutions for this issue

@Haswell-s
Copy link
Collaborator Author

Haswell-s commented Feb 7, 2024

@NoamGaash
So I found out that this issue is because instead of showing all the operators, we show only the major and pass the filtered as the options to Autocomplete:

// OperatorSelector

        setOperators(
          filter == FilterOperatorOptions.MAJOR && resultObj
            ? resultObj.filter((item) => majorOperatorsIds.includes(item.id))
            : resultObj,
        ),
// OperatorSelector

  return (
    <Autocomplete
      disablePortal
      style={{ width: '100%' }}
      value={value}
      onChange={(e, value) => setOperatorId(value ? value.id : '')}
      id="operator-select"
      options={operators}
      renderInput={(params) => <TextField {...params} label={t('choose_operator')} />}
      getOptionLabel={(option) => option.name}
    />
  )

So I figured that changing the OperatorSelector's attribute from FilterOperatorOptions.MAJOR to ALL should've fixed it.

// Dashboard

          <OperatorSelector
            operatorId={operatorId}
            setOperatorId={setOperatorId}
            filter={FilterOperatorOptions.MAJOR} // Changing from MAJOR to ALL should've fixed it
          />

but turns out that this filtering mechanic is buggy by itself.

After changing to ALL:

Screen.Recording.2024-02-07.at.22.30.50.mov

So to start off I would say my solution to the inconsistency would be to remove the filtering from OperatorSelector, display all operators and let autocomplete do the job.

Secondly displaying all the operators clearly needs some work so there is that.

@Haswell-s
Copy link
Collaborator Author

Haswell-s commented Feb 7, 2024

BTW the data for OperatorSelector is beign pulled from the API, so all the inconsistencies arrise from the filtering.
In my opinion having the exact same input field display different ammounts of data over the app is not a good UX, displaying all the options and scrolling through them is much better in my opinion.

@Haswell-s Haswell-s added bug Something isn't working frontend frontend developers issue and removed clarification needed labels Feb 23, 2024
@Haswell-s Haswell-s self-assigned this Feb 23, 2024
@Haswell-s
Copy link
Collaborator Author

Screen.Recording.2024-02-24.at.11.31.41.mov

A followup on this issue is some wierdness with WorstLinesChart, where operators that aren't included in RELEVENT are not displayed properly.

@NoamGaash
Copy link
Member

@all-contributors please add @Haswell-s for code

Copy link
Contributor

@NoamGaash

I've put up a pull request to add @Haswell-s! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend frontend developers issue
Projects
None yet
Development

No branches or pull requests

2 participants