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

Changed url for PereiraJS (Colombia) meetup #398

Merged
5 commits merged into from
Mar 30, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion events/pull-meetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ function finish (events) {
const region = yml.getRegion(countryMap[event.country])
if (!region.meetups) region.meetups = []
clean(event)
yml.replace(region.meetups, 'name', event.name, event)
if (!yml.isSoT(region, event.city, event.name)) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we use region.meetups here instead of region?

yml.replace(region.meetups, 'name', event.name, event)
}
})
yml.save()
}
Expand Down
14 changes: 14 additions & 0 deletions events/yaml-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ function getRegion (region) {
return reg
}

function isSoT (region, city, name) {
let meetups = region.meetups
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove this line if the first argument of the function is changed to meetups.

for (const i in meetups) {
Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't use for...in to iterate over an array.

if (meetups[i].city === city && meetups[i].name === name) {
if (meetups[i].source_of_truth) {
return true
}
return false
}
}
return false
}

function removeEmpty (dict) {
for (const i in dict) {
if (!dict[i]) delete dict[i]
Expand All @@ -46,3 +59,4 @@ exports.removeEmpty = removeEmpty
exports.getRegion = getRegion
exports.replace = replace
exports.save = save
exports.isSoT = isSoT
Loading