You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/07/03 21:38:47 UTC

[GitHub] [fineract] adamsaghy opened a new pull request, #2402: Business date part 3

adamsaghy opened a new pull request, #2402:
URL: https://github.com/apache/fineract/pull/2402

   ## Description
   
   Describe the changes made and why they were made.
   
   Ignore if these details are present on the associated [Apache Fineract JIRA ticket](https://github.com/apache/fineract/pull/1284).
   
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Write the commit message as per https://github.com/apache/fineract/#pull-requests
   
   - [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
   
   - [ ] Create/update unit or integration tests for verifying the changes made.
   
   - [ ] Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
   
   - [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
   
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the developer mailing list for guidance, if required.)
   
   FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912811386


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/database/DatabaseSpecificSQLGenerator.java:
##########
@@ -168,4 +168,14 @@ public String currentSchema() {
             throw new IllegalStateException("Database type is not supported for current schema " + databaseTypeResolver.databaseType());
         }
     }
+
+    public String getBoolean(boolean condition) {
+        if (databaseTypeResolver.isMySQL()) {

Review Comment:
   I can accept that, but... it is not "worse" pattern like providing a boolean to the tinyInt (which is number)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912802081


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/database/DatabaseSpecificSQLGenerator.java:
##########
@@ -168,4 +168,14 @@ public String currentSchema() {
             throw new IllegalStateException("Database type is not supported for current schema " + databaseTypeResolver.databaseType());
         }
     }
+
+    public String getBoolean(boolean condition) {
+        if (databaseTypeResolver.isMySQL()) {

Review Comment:
   i have the feeling, i might learn something new today :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] galovics commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
galovics commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912792275


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/database/DatabaseSpecificSQLGenerator.java:
##########
@@ -168,4 +168,14 @@ public String currentSchema() {
             throw new IllegalStateException("Database type is not supported for current schema " + databaseTypeResolver.databaseType());
         }
     }
+
+    public String getBoolean(boolean condition) {
+        if (databaseTypeResolver.isMySQL()) {

Review Comment:
   https://dev.mysql.com/doc/refman/5.7/en/boolean-literals.html @adamsaghy 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] galovics merged pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
galovics merged PR #2402:
URL: https://github.com/apache/fineract/pull/2402


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912789842


##########
fineract-provider/src/main/java/org/apache/fineract/notification/eventandlistener/SpringNotificationEventListener.java:
##########
@@ -38,6 +39,7 @@ public class SpringNotificationEventListener implements ApplicationListener<Noti
     public void onApplicationEvent(NotificationEvent event) {
         log.debug("Processing Spring notification event {}", event);
         ThreadLocalContextUtil.init(event.getContext());
+        ThreadLocalContextUtil.setActionContext(ActionContext.COB);

Review Comment:
   :o 
   It's a mistake! Nice catch!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] galovics commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
galovics commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912809691


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/database/DatabaseSpecificSQLGenerator.java:
##########
@@ -168,4 +168,14 @@ public String currentSchema() {
             throw new IllegalStateException("Database type is not supported for current schema " + databaseTypeResolver.databaseType());
         }
     }
+
+    public String getBoolean(boolean condition) {
+        if (databaseTypeResolver.isMySQL()) {

Review Comment:
   Right but the thing is, if they search for the String version of true/false/1/0 that's already indicating a very bad pattern to me which should be fixed, don't you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912811386


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/database/DatabaseSpecificSQLGenerator.java:
##########
@@ -168,4 +168,14 @@ public String currentSchema() {
             throw new IllegalStateException("Database type is not supported for current schema " + databaseTypeResolver.databaseType());
         }
     }
+
+    public String getBoolean(boolean condition) {
+        if (databaseTypeResolver.isMySQL()) {

Review Comment:
   I can accept that, but... it is not "worse" pattern like providing a boolean to the tinyInt (which is number).
   Let me fix that 5 occasion then :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] galovics commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
galovics commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912774406


##########
fineract-provider/src/main/java/org/apache/fineract/notification/eventandlistener/SpringNotificationEventListener.java:
##########
@@ -38,6 +39,7 @@ public class SpringNotificationEventListener implements ApplicationListener<Noti
     public void onApplicationEvent(NotificationEvent event) {
         log.debug("Processing Spring notification event {}", event);
         ThreadLocalContextUtil.init(event.getContext());
+        ThreadLocalContextUtil.setActionContext(ActionContext.COB);

Review Comment:
   Do you mind explaining it why we need to have COB context here? Thanks.



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/database/DatabaseSpecificSQLGenerator.java:
##########
@@ -168,4 +168,14 @@ public String currentSchema() {
             throw new IllegalStateException("Database type is not supported for current schema " + databaseTypeResolver.databaseType());
         }
     }
+
+    public String getBoolean(boolean condition) {
+        if (databaseTypeResolver.isMySQL()) {

Review Comment:
   Do we need this? MySQL supports `true` and `false` values.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] galovics commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
galovics commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912792597


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/database/DatabaseSpecificSQLGenerator.java:
##########
@@ -168,4 +168,14 @@ public String currentSchema() {
             throw new IllegalStateException("Database type is not supported for current schema " + databaseTypeResolver.databaseType());
         }
     }
+
+    public String getBoolean(boolean condition) {
+        if (databaseTypeResolver.isMySQL()) {

Review Comment:
   We have true/false values in native queries all over the codebase and they work flawlessly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912791122


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/database/DatabaseSpecificSQLGenerator.java:
##########
@@ -168,4 +168,14 @@ public String currentSchema() {
             throw new IllegalStateException("Database type is not supported for current schema " + databaseTypeResolver.databaseType());
         }
     }
+
+    public String getBoolean(boolean condition) {
+        if (databaseTypeResolver.isMySQL()) {

Review Comment:
   Mysql is not supporting true or false :) It supports only the tinyint (1/0)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912808115


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/database/DatabaseSpecificSQLGenerator.java:
##########
@@ -168,4 +168,14 @@ public String currentSchema() {
             throw new IllegalStateException("Database type is not supported for current schema " + databaseTypeResolver.databaseType());
         }
     }
+
+    public String getBoolean(boolean condition) {
+        if (databaseTypeResolver.isMySQL()) {

Review Comment:
   Well...the truth lies between.
   select * from stretchy_report where self_service_user_report = '0'; -> Valid
   select * from stretchy_report where self_service_user_report = '1'; -> Valid
   select * from stretchy_report where self_service_user_report = 0; -> Valid
   select * from stretchy_report where self_service_user_report = 1; -> Valid
   select * from stretchy_report where self_service_user_report = false; -> Valid
   select * from stretchy_report where self_service_user_report = true; -> Valid
   select * from stretchy_report where self_service_user_report = 'false'; -> Valid, but by sheer luck (no error, but evaluate as false)
   select * from stretchy_report where self_service_user_report = 'true'; -> Invalid, no error and evaluate it as false
   
   Unfortunately, the stretchy report SQLs are using sometimes as a string this value.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [fineract] galovics commented on a diff in pull request #2402: Business date part 3

Posted by GitBox <gi...@apache.org>.
galovics commented on code in PR #2402:
URL: https://github.com/apache/fineract/pull/2402#discussion_r912826685


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/database/DatabaseSpecificSQLGenerator.java:
##########
@@ -168,4 +168,14 @@ public String currentSchema() {
             throw new IllegalStateException("Database type is not supported for current schema " + databaseTypeResolver.databaseType());
         }
     }
+
+    public String getBoolean(boolean condition) {
+        if (databaseTypeResolver.isMySQL()) {

Review Comment:
   >  it is not "worse" pattern like providing a boolean to the tinyInt 
   
   I don't agree with that. If the database engine provides the true/false literals and it'll translate them into 1/0 values, that's much better if you're really representing boolean values instead of using the numbers themselves. It's just semantically better.
   
   Same for the booleans in Java. The underlying JVM represents them as 0/1 bits and I bet you don't want to use numbers there too. ;-)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org