Skip to content

Commit

Permalink
[MIM-1883] Mim 1883 publish dataset draft (#2930)
Browse files Browse the repository at this point in the history
* Teste å hente draftversjon

* Added datasource from draft

* Remove logging

* Fjern Michael som autoassign
  • Loading branch information
ssb-cgn authored Oct 10, 2024
1 parent d58fdaf commit 339bdac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
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

0 comments on commit 339bdac

Please sign in to comment.