Skip to content

Commit bf5bebb

Browse files
Merge pull request #200 from CodeForPhilly/check-lookup-fix
fix: updated check lookup to use Document ID instead of ID property
2 parents 883fe67 + 23e1ffd commit bf5bebb

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

builder-api/src/main/java/org/acme/persistence/FirestoreUtils.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ public static List<Map<String, Object>> getFirestoreDocsByIds(String collection,
120120

121121
public static Optional<Map<String, Object>> getFirestoreDocById(String collection, String id) {
122122
try {
123-
124123
DocumentSnapshot doc = db.collection(collection)
125124
.document(id)
126125
.get().get();
@@ -130,7 +129,6 @@ public static Optional<Map<String, Object>> getFirestoreDocById(String collectio
130129
return Optional.empty();
131130
}
132131

133-
134132
Map<String, Object> data = doc.getData();
135133
data.put("id", doc.getId());
136134

builder-api/src/main/java/org/acme/persistence/StorageService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public interface StorageService {
2323

2424
String getScreenerPublishedFormSchemaPath(String screenerId);
2525

26-
2726
String getCheckDmnModelPath(String userId, String checkId);
2827

2928
String getCheckDmnModelPath(String userId, String module, String checkId, Integer version);

builder-api/src/main/java/org/acme/persistence/impl/EligibilityCheckRepositoryImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ public Optional<EligibilityCheck> getPublishedCustomCheck(String userId, String
8787
private Optional<EligibilityCheck> getCustomCheck(String userId, String checkId, boolean isPublished){
8888
String collectionName = isPublished ? CollectionNames.PUBLISHED_CUSTOM_CHECK_COLLECTION : CollectionNames.WORKING_CUSTOM_CHECK_COLLECTION;
8989

90-
List<Map<String, Object>> checkMaps = FirestoreUtils.getFirestoreDocsByField(collectionName, FieldNames.ID, checkId);
91-
if (checkMaps.isEmpty()){
90+
Optional<Map<String, Object>> checkMap = FirestoreUtils.getFirestoreDocById(collectionName, checkId);
91+
if (checkMap.isEmpty()){
9292
return Optional.empty();
9393
}
94-
Map<String, Object> data = checkMaps.getFirst();
94+
Map<String, Object> data = checkMap.get();
9595

9696
ObjectMapper mapper = new ObjectMapper();
9797
EligibilityCheck check = mapper.convertValue(data, EligibilityCheck.class);

0 commit comments

Comments
 (0)