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

[MIM-1883] Mim 1883 publish dataset draft #2930

Merged
merged 5 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/auto_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ assignees:
- johnnadeluy
# - annesiri
- Carl-OW
- michaelpande
# - michaelpande

# A number of assignees to add to the pull request
# Set to 0 to add all of the assignees.
Expand Down
14 changes: 13 additions & 1 deletion src/main/resources/lib/ssb/dataset/publishOld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { get as getContent, Content } from '/lib/xp/content'
import { NodeQueryResultHit } from '/lib/xp/node'
import { send } from '/lib/xp/event'
import { executeFunction, sleep } from '/lib/xp/task'
import { run, type ContextParams } from '/lib/xp/context'
import { isSameOrBefore } from '/lib/ssb/utils/dateUtils'
import { isSameDay } from '/lib/vendor/dateFns'

Expand Down Expand Up @@ -111,7 +112,18 @@ export function publishDataset(): void {
status: JobStatus.STARTED,
dataSources: [],
}
const dataSourceIds: Array<string> = getDataSourceIdsFromStatistics(stat)
const draftContext: ContextParams = {
branch: 'draft',
}
const statisticDraft: Content<Statistics> | null = run(draftContext, () => {
return getContent({ key: stat._id })
})
const dataSourceIdsMaster: Array<string> = getDataSourceIdsFromStatistics(stat)
const dataSourceIdsDraft: Array<string> = statisticDraft ? getDataSourceIdsFromStatistics(statisticDraft) : []
const uniqueDatasourceDraft: Array<string> = dataSourceIdsDraft.filter(
(item) => !dataSourceIdsMaster.includes(item)
)
const dataSourceIds: Array<string> = dataSourceIdsMaster.concat(uniqueDatasourceDraft)
const dataSources: Array<Content<DataSource> | null> = dataSourceIds.map((key) => {
return getContent({
key,
Expand Down
Loading