Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 37c7b3d1
authored
Jun 11, 2022
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
double print card fix
1 parent
5b025711
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
code/moya-beans/ejbModule/fi/codecrew/moya/beans/CardTemplateBean.java
code/moya-web/src/main/java/fi/codecrew/moya/handler/SessionStore.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/CardTemplateBean.java
View file @
37c7b3d
...
...
@@ -358,15 +358,26 @@ public class CardTemplateBean implements CardTemplateBeanLocal {
@Override
public
PrintedCard
setCardState
(
Integer
cardId
,
CardState
state
)
throws
Exception
{
PrintedCard
card
=
printedcardfacade
.
find
(
cardId
);
switch
(
state
)
{
case
VALIDATED:
Calendar
mustBePrintedBefore
=
Calendar
.
getInstance
();
mustBePrintedBefore
.
add
(
Calendar
.
MINUTE
,
-
1
);
if
(
card
.
getCardState
().
equals
(
CardState
.
PRINTED
)
&&
card
.
getPrintTime
().
before
(
mustBePrintedBefore
))
{
String
response
=
"Already printed in one minute."
;
throw
new
Exception
(
response
);
}
break
;
case
PRINTED:
card
.
setPrintCount
(
card
.
getPrintCount
()
+
1
);
card
.
setPrintTime
(
Calendar
.
getInstance
());
break
;
case
PRINTING_IN_PROGRESS:
if
(
card
.
getCardState
().
equals
(
CardState
.
PRINTING_IN_PROGRESS
)
||
card
.
getCardState
().
equals
(
CardState
.
PRINTED
))
{
||
card
.
getCardState
().
equals
(
CardState
.
PRINTED
)
||
card
.
getCardState
().
equals
(
CardState
.
DELIVERED
))
{
String
response
=
"Unable to change type to PRINTING_IN_PROGRESS value is already {}"
+
card
.
getCardState
();
logger
.
warn
(
response
);
throw
new
Exception
(
response
);
...
...
code/moya-web/src/main/java/fi/codecrew/moya/handler/SessionStore.java
View file @
37c7b3d
...
...
@@ -26,6 +26,8 @@ import javax.enterprise.context.SessionScoped;
import
javax.faces.context.FacesContext
;
import
javax.inject.Named
;
import
fi.codecrew.moya.model.EventOrganiser
;
import
fi.codecrew.moya.model.LanEvent
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -53,7 +55,9 @@ public class SessionStore implements Serializable {
Locale
ret
=
locale
;
if
(
ret
==
null
||
ret
.
toString
().
equals
(
""
))
{
String
retStr
=
eventbean
.
getCurrentEvent
().
getOrganiser
().
getBundleCountry
();
LanEvent
e
=
eventbean
.
getCurrentEvent
();
EventOrganiser
o
=
e
.
getOrganiser
();
String
retStr
=
o
.
getBundleCountry
();
if
(
retStr
!=
null
&&
!
retStr
.
isEmpty
())
{
try
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment