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

Remove invalid data #75

Open
wants to merge 3 commits into
base: next
Choose a base branch
from

Conversation

RobertFridolin
Copy link
Contributor

@RobertFridolin RobertFridolin commented Jun 14, 2024

fix: remove invalid data

fixes #20

attempt to delete invalid data
attempt 2 to delete invalid data

added some more data to clean
more consistent Promise use
removed some unnecessary code
@@ -7,16 +7,73 @@ $(function() {
airline = AES.getAirlineCode();
server = AES.getServerName();
chrome.storage.local.get(['settings'], function(result) {
settings = result.settings;
settings = result.settings;
Copy link
Owner

Choose a reason for hiding this comment

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

Can I ask why you changed the indenting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that was not intentional


displayDashboard();
if ((settings['flightInformationsFixed'] === undefined) || (settings['flightInformationsFixed'] !== 1)) {
Copy link
Owner

Choose a reason for hiding this comment

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

I thought it might be nice to base this on version number. Perhaps we could do if versionNumber < 0.6.9? What do you think?

Copy link
Contributor Author

@RobertFridolin RobertFridolin Jun 15, 2024

Choose a reason for hiding this comment

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

Of course you can do that, but i don't know when exactly the version number changes. So i used this simple "versioning" 1,2,3 in case further fixes are necessary and people already using this need to rerun this.

});
});

function fixAndDeleteInvalidData() {
Copy link
Owner

Choose a reason for hiding this comment

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

Can you please adjust the indent size to .editorconfig spec?

Copy link
Contributor Author

@RobertFridolin RobertFridolin Jun 15, 2024

Choose a reason for hiding this comment

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

Sure, had this set to two because the whole AES code was/is 2 spaces.

chrome.storage.local.get(null, function (entries) {
const tasks = [];

function cleanAndSave(entry, key) {
Copy link
Owner

Choose a reason for hiding this comment

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

Is there a reason this function is nested?

Copy link
Contributor Author

@RobertFridolin RobertFridolin Jun 15, 2024

Choose a reason for hiding this comment

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

It has access to entries then and functionallity belonged to fixAndDeleteInvalidData, nothing special.
Of course it can be written differently and also moved somewhere else if you want, in content_dashboard.js is already very large anyway.
But it's actually only there temporarily, isn't it?

Copy link
Owner

Choose a reason for hiding this comment

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

We should write code as if it were permanent.

Improving the code base is a long term project :)

Copy link
Contributor Author

@RobertFridolin RobertFridolin Jun 16, 2024

Choose a reason for hiding this comment

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

Well, i think this is a code style question. Just rewrite it according to your wishes. :)

});
});

function fixAndDeleteInvalidData() {
chrome.storage.local.get(null, function (entries) {
Copy link
Owner

Choose a reason for hiding this comment

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

It might be nice to get the data into a const with an await. Fewer nesting levels make the code easier to read.

Copy link
Contributor Author

@RobertFridolin RobertFridolin Jun 15, 2024

Choose a reason for hiding this comment

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

Yes maybe, it was just good good enough for temporary use. Do you want to change it?

Copy link
Owner

Choose a reason for hiding this comment

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

I would like you to change it, yes.

Promise.all(tasks).then(() => {
chrome.storage.local.get('settings', function (result) {
const settings = result.settings || {};
settings.flightInformationsFixed = 1;
Copy link
Owner

Choose a reason for hiding this comment

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

perhaps instead of a 1 this could be true | false. Or better yet the current AES version number? That way we could verify / update the data in the future

Copy link
Contributor Author

@RobertFridolin RobertFridolin Jun 15, 2024

Choose a reason for hiding this comment

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

i added 1 one in case if it needs further fixing, see second answer above

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.

data contains “NaN” entries
2 participants