-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: next
Are you sure you want to change the base?
Conversation
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
fix: remove invalid data
fixes #20