Skip to content

/series/info: TemplateProcessingException when transaction doesn't have a price #467

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

Closed
php-coder opened this issue Aug 27, 2016 · 7 comments
Assignees
Labels
Milestone

Comments

@php-coder
Copy link
Owner

php-coder commented Aug 27, 2016

At present field first_price in the series_sales table allow to have NULL value but the series info page couldn't be opened because it leads to the exception:

2016-08-27 23:45:57.952 ERROR 37615 --- [qtp800234896-39] r.m.web.controller.ErrorController       : Exception 'org.springframework.web.util.NestedServletException' occurred at page /series/2

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Error formatting decimal with minimum integer digits = 0, thousands point type = DEFAULT, decimal digits = 2 and decimal point type = DEFAULT (series/info:264)
...
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Error formatting decimal with minimum integer digits = 0, thousands point type = DEFAULT, decimal digits = 2 and decimal point type = DEFAULT (series/info:264)
...
Caused by: java.lang.IllegalArgumentException: Cannot apply format on null

How to reproduce:

  • create the transaction with NULL as value of first_price column
  • open page with info about this series

Example:

insert into series_sales(series_id,seller_id,buyer_id) values(1,2,3);

Related to #198

@php-coder php-coder added this to the 0.4 milestone Aug 27, 2016
@php-coder php-coder changed the title /series/info: TemplateProcessingException when transaction doesn't have price /series/info: TemplateProcessingException when transaction doesn't have price/currency Aug 27, 2016
@php-coder
Copy link
Owner Author

@cssru What should be the proper behavior? We should correctly handle such cases or prohibit NULL values?

@php-coder php-coder changed the title /series/info: TemplateProcessingException when transaction doesn't have price/currency /series/info: TemplateProcessingException when transaction doesn't have price Aug 27, 2016
@cssru
Copy link
Contributor

cssru commented Aug 28, 2016

If first price is null, the record is useless. We should disallow to add records with null first price.

@cssru
Copy link
Contributor

cssru commented Aug 28, 2016

So, I was wrong.
Let's analyze it (without URL's):
12.11.2014 [1] Slavik [2] sold to Pasha [3] for 100 USD [4] (6500 RUB)

  • [1] can be null, because admin may doesn't know when it was, so we write nothing to output.
    It will be something like "Slavik sold to Pasha for 100 USD (6500 RUB)".
  • [2] can also be null, because admin can forget name of seller. In this case I suggest use word "someone".
    Output will be: "Someone sold to Pasha for 100 USD (6500 RUB)"
  • [3] can be null.
    Will be: "Someone sold for 100 USD (6500 RUB)". You can ask why we need this record? We know price of series, and it is useful, isn't it?
  • [4] can be null, but it is useful only if one of previous fields is not null.
    For example: "Someone sold this series" - wrong and useless.
    "Slavik sold this series" - useful, because we can call to Slavik and ask for him about this series.
    But we should disable setting first price to NULL and second price to NOT NULL, 'cause it's weird, right? I suggest to do it in validator (I don't know database constraints that allows such dependings).

@php-coder
Copy link
Owner Author

[2] can also be null, because admin can forget name of seller. In this case I suggest use word "someone". Output will be: "Someone sold to Pasha for 100 USD (6500 RUB)"

If this occurs then admin can create special user with name "Someone" and it did the trick. But it's a very-very case than can be omitted.

[3] can be null. Will be: "Someone sold for 100 USD (6500 RUB)". You can ask why we need this record? We know price of series, and it is useful, isn't it?

Yes, this is the case when someone was selling but probably without luck or we didn't know who was the buyer.

[4] can be null, but it is useful only if one of previous fields is not null. For example: "Someone sold this series" - wrong and useless. "Slavik sold this series" - useful, because we can call to Slavik and ask for him about this series.

No, I disagree. The main point of this is a price. I'm not interesting in the information that Pasha was selling this series in 10.12.2000. But if here will be the price it will be more interesting, because I will be able to compare prices between dates.

First price and first currency fields must be non-null.

@cssru
Copy link
Contributor

cssru commented Aug 28, 2016

admin can create special user with name "Someone"

Admin can't create special user. For what? We just use special word "Someone" for defining unknown seller.

I'm not interesting in the information that Pasha was selling this series in 10.12.2000.

And what if you don't know price quite yet?

@php-coder
Copy link
Owner Author

admin can create special user with name "Someone"

Admin can't create special user. For what? We just use special word "Someone" for defining unknown seller.

At present it can't. But will be able, because without this how users (I mean transaction participants) will appear?

I'm not interesting in the information that Pasha was selling this series in 10.12.2000.

And what if you don't know price quite yet?

I don't add this information to our database then. This information is useless in terms of our site.

@cssru
Copy link
Contributor

cssru commented Aug 29, 2016

I just suggest to use word "someone" in view to render NULL values of transactions participants. No fake user required, that's I mean.
Of course in Russian locale it will be like "некто" or "какой-то чувак" :-)
Enjoy it: "Когда-то [date IS NULL] какой-то чувак [seller IS NULL] продал какому-то чуваку [buyer IS NULL] за 100 RUB". Do you think it's nice localization, don't ya?

@php-coder php-coder changed the title /series/info: TemplateProcessingException when transaction doesn't have price /series/info: TemplateProcessingException when transaction doesn't have a price Oct 10, 2016
bodom91 pushed a commit to bodom91/mystamps that referenced this issue Aug 2, 2017
…t have a price.

Mark first_price and first_currency fields in series_sales table as non-nullable.

Fix php-coder#467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants