Skip to content

Commit

Permalink
feat: use app_hub_id field
Browse files Browse the repository at this point in the history
  • Loading branch information
mediremi committed Feb 24, 2021
1 parent 17f508e commit 43d6ddf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/components/CoreApps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ const CoreApps = () => {
})
.map(app => ({
...app,
appHub: data?.appHub.find(
({ name, developer }) =>
name === app.name && developer.organisation === 'DHIS2'
),
appHub: data?.appHub.find(({ id, name, developer }) => {
if (app.app_hub_id) {
return id === app.app_hub_id
}
return name === app.name && developer.organisation === 'DHIS2'
}),
}))
const appsWithUpdates = apps.filter(
app =>
(!app.version && app.appHub?.id) ||
(app.appHub &&
app.version !== getLatestVersion(app.appHub.versions))
app.appHub && app.version !== getLatestVersion(app.appHub.versions)
)

return (
Expand Down
10 changes: 7 additions & 3 deletions src/components/CustomApps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ const CustomApps = () => {
.filter(app => !app.bundled)
.map(app => ({
...app,
appHub: data.appHub.find(
({ name, developer }) =>
appHub: data.appHub.find(({ id, name, developer }) => {
if (app.app_hub_id) {
return id === app.app_hub_id
}
return (
name === app.name &&
app.developer &&
(developer.organisation ===
(app.developer.company || app.developer.name) ||
developer.name === app.developer.name)
),
)
}),
}))
const appsWithUpdates = apps?.filter(
app =>
Expand Down

0 comments on commit 43d6ddf

Please sign in to comment.