Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public GoalTopic saveTopic(GoalTopic topic) {

@Transactional
public GoalTopic doImport(Long studyId, GoalTopic topic) {
var existing = getTopic(topic.getStudyId(), topic.getKey());
var existing = getTopic(studyId, topic.getKey());
if(existing == null) {
// Force the correct studyId — ignore whatever came in the object
topic.setStudyId(studyId);
Expand Down Expand Up @@ -159,8 +159,7 @@ public GoalAdherenceCheck doImport(Long studyId, GoalAdherenceCheck check) {
namedTemplate.update(
IMPORT_ADHERENCE_CHECK,
toParams(check)
.addValue("study_id", studyId)
.addValue("check_id", check.getCheckId()),
.addValue("study_id", studyId),
keyHolder,
new String[]{"check_id"}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,12 @@ void testDoImportGoalTopic() {
GoalTopic reImported = goalConfigurationRepository.doImport(studyB, updatedVersion);

assertThat(reImported.getStudyId()).isEqualTo(studyB);
assertThat(reImported.getTitle()).isEqualTo("Updated - Drink More Water");
//it is expected that it is NOT overridden if already existing. So the old title is expected
assertThat(reImported.getTitle()).isEqualTo("Drink Water");

//validate also directly in the DB
assertThat(goalConfigurationRepository.getTopic(studyB, "hydration").getTitle())
.isEqualTo("Updated - Drink More Water");
.isEqualTo("Drink Water");
}

@Test
Expand Down
Loading