Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBPIH-4581 Allow autoincrement on default product type #3413

Merged
merged 3 commits into from
Sep 12, 2022
Merged

Conversation

awalkowiak
Copy link
Collaborator

… type

Added DEFAULT ProductType to the db migrations
@awalkowiak awalkowiak marked this pull request as ready for review September 5, 2022 22:12
@awalkowiak
Copy link
Collaborator Author

awalkowiak commented Sep 5, 2022

@jmiranda this one is ready for review. I gave up on the previous version because it was generating more "what ifs" than it made sense. I added the DEFAULT Product Type to the DB and added the option to change the current sequence number for the super users.

Note: I'll fix tests tomorrow (done)

@awalkowiak awalkowiak changed the title OBPIH-4581 WIP - PoC of sequentional product code for default product… OBPIH-4581 Allow autoincrement on default product type Sep 5, 2022
grails-app/conf/Config.groovy Show resolved Hide resolved
def findOrCreateProductType(String productTypeName) {
def productType = ProductType.findByName(productTypeName)
if (!productType) {
println("Could not find product type " + productTypeName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we can use log.info or remove this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@@ -17,4 +19,18 @@ class ProductTypeService {

return productType.sequenceNumber
}

def getDefaultProductType() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine as-is, but this could also be implemented as a named query on the ProductType domain.

http://docs.grails.org/latest/ref/Domain%20Classes/namedQueries.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially added it in the domain, but when I was calling it in the gsp template I was getting weird exception, hence I moved it here. I'll try again with domain version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I have not tried a named query then, perhaps it will be better. Thanks for the suggestion.

@awalkowiak awalkowiak merged commit 98706a1 into develop Sep 12, 2022
@awalkowiak awalkowiak deleted the OBPIH-4581 branch September 12, 2022 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants