Skip to content
Open
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
8 changes: 4 additions & 4 deletions src/main/java/com/iemr/flw/config/PrimaryDBConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public class PrimaryDBConfig {
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
PoolConfiguration p = new PoolProperties();
p.setMaxActive(30);
p.setMaxIdle(15);
p.setMinIdle(5);
p.setInitialSize(5);
p.setMaxActive(100);
p.setMaxIdle(50);
p.setMinIdle(10);
p.setInitialSize(10);
p.setMaxWait(10000);
p.setMinEvictableIdleTimeMillis(15000);
p.setRemoveAbandoned(true);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/iemr/flw/config/SecondaryDBConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public class SecondaryDBConfig {
@ConfigurationProperties(prefix = "secondary.datasource")
public DataSource dataSource() {
PoolConfiguration p = new PoolProperties();
p.setMaxActive(30);
p.setMaxIdle(15);
p.setMinIdle(5);
p.setInitialSize(5);
p.setMaxActive(100);
p.setMaxIdle(50);
p.setMinIdle(10);
p.setInitialSize(10);
p.setMaxWait(10000);
p.setMinEvictableIdleTimeMillis(15000);
p.setRemoveAbandoned(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
* A single question's answer within a section answer request.
* Exactly one of optionValue, optionValues, answerText, or answerDate should be set per question type:
* RADIO → optionValue (single string)
* CHECKBOX → optionValue (single string, e.g. "CHECKED")
* MCQ → optionValues (list of strings, one row saved per element)
* TEXT/AUTO_FILL → answerText
* DATE → answerDate (ISO date string) or answerText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class QuestionResponseDTO {

private Long questionResponseId;
private Long questionId;
/** Populated for RADIO, MCQ, and CHECKBOX answers. */
/** Populated for RADIO and MCQ answers. */
private Long optionId;
/** Populated for TEXT, DATE, AUTO_FILL answers. */
private String answerText;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/iemr/flw/masterEnum/QuestionType.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public enum QuestionType {
RADIO,
/** Multi-select from a predefined list of options. */
MCQ,
/** Single boolean checkbox — checked or unchecked. Resolved like RADIO: submit
* optionValue to select it, omit to leave unanswered. */
/** Single boolean checkbox — checked or unchecked. May carry options for display
* purposes; answers are still stored as free text. */
CHECKBOX,
/** Free-text input. */
TEXT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,25 +358,6 @@ private String getMappingsForAddressIDs(List<RMNCHMBeneficiaryaddress> addressLi
if (benDetailsRMNCH_OBJ.getGpsLongitude() != null)
benDetailsRMNCH_OBJ.setLongitude(BigDecimal.valueOf(benDetailsRMNCH_OBJ.getGpsLongitude()));

// GPS fallback: if not in RMNCH details (syncdatatoamrti not yet called),
// pull from i_beneficiaryaddress (saved during TM-API registration)
if (benDetailsRMNCH_OBJ.getGpsLatitude() == null && benAddressOBJ.getGpsLatitude() != null)
benDetailsRMNCH_OBJ.setGpsLatitude(benAddressOBJ.getGpsLatitude());
if (benDetailsRMNCH_OBJ.getGpsLongitude() == null && benAddressOBJ.getGpsLongitude() != null)
benDetailsRMNCH_OBJ.setGpsLongitude(benAddressOBJ.getGpsLongitude());
if (benDetailsRMNCH_OBJ.getDigipin() == null && benAddressOBJ.getDigipin() != null)
benDetailsRMNCH_OBJ.setDigipin(benAddressOBJ.getDigipin());
if (benDetailsRMNCH_OBJ.getGpsTimestamp() == null && benAddressOBJ.getGpsTimestamp() != null)
benDetailsRMNCH_OBJ.setGpsTimestamp(benAddressOBJ.getGpsTimestamp());
if (benDetailsRMNCH_OBJ.getIsGpsUnavailable() == null && benAddressOBJ.getIsGpsUnavailable() != null)
benDetailsRMNCH_OBJ.setIsGpsUnavailable(benAddressOBJ.getIsGpsUnavailable());

// Map GPS double fields to the exposed latitude/longitude BigDecimal fields for response
if (benDetailsRMNCH_OBJ.getGpsLatitude() != null)
benDetailsRMNCH_OBJ.setLatitude(BigDecimal.valueOf(benDetailsRMNCH_OBJ.getGpsLatitude()));
if (benDetailsRMNCH_OBJ.getGpsLongitude() != null)
benDetailsRMNCH_OBJ.setLongitude(BigDecimal.valueOf(benDetailsRMNCH_OBJ.getGpsLongitude()));

// -----------------------------------------------------------------------------

// related benids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import com.iemr.flw.dto.iemr.SectionResponseDTO;
import com.iemr.flw.domain.iemr.DynamicForm;
import com.iemr.flw.masterEnum.FormResponseStatus;
import com.iemr.flw.masterEnum.FormResponseStatus;
import com.iemr.flw.masterEnum.FormType;
import com.iemr.flw.repo.iemr.DynamicFormRepo;
import com.iemr.flw.repo.iemr.FormResponseRepo;
Expand Down Expand Up @@ -389,7 +388,7 @@ private List<QuestionResponse> processAnswers(
// Delete any existing answers for this question in this section (handles re-saves)
questionResponseRepo.deleteByQuestionIdAndSectionResponseId(questionId, sectionResponseId);

if (type == QuestionType.RADIO || type == QuestionType.CHECKBOX) {
if (type == QuestionType.RADIO) {
if (answer.getOptionValue() != null) {
QuestionOption opt = resolveOption(
optionsByQuestion, questionId, answer.getOptionValue(), answer.getQuestionUuid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private List<QuestionResponse> processAnswers(

questionResponseRepo.deleteByQuestionIdAndSectionResponseId(questionId, sectionResponseId);

if (type == QuestionType.RADIO || type == QuestionType.CHECKBOX) {
if (type == QuestionType.RADIO) {
if (answer.getOptionValue() != null) {
QuestionOption opt = resolveOption(optionsByQuestion, questionId,
answer.getOptionValue(), answer.getQuestionUuid());
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Response compression — shrinks large JSON responses (e.g. getAll-style endpoints) over the
# wire without changing the API contract; honors the Accept-Encoding: gzip clients already send.
server.compression.enabled=true
server.compression.mime-types=application/json,application/xml,text/html,text/plain,text/css,application/javascript
server.compression.min-response-size=1024

spring.main.banner-mode=off
spring.data.jpa.repositories.enabled=true
spring.jpa.hibernate.ddl-auto=create
Expand Down