
Merge branch 'pv/exception' of whiteship/yobi
from pull request 742
@e47898375811eab2c066cda977dd1affa0117211
--- app/models/RecentlyVisitedProjects.java
+++ app/models/RecentlyVisitedProjects.java
... | ... | @@ -59,18 +59,20 @@ |
59 | 59 |
*/ |
60 | 60 |
@Transactional |
61 | 61 |
public static RecentlyVisitedProjects addNewVisitation(User user, Project project) { |
62 |
- RecentlyVisitedProjects existingOne = find.where().eq("user", user).findUnique(); |
|
63 |
- if(existingOne != null) { |
|
64 |
- existingOne.add(project); |
|
65 |
- existingOne.update(); |
|
66 |
- return existingOne; |
|
67 |
- } |
|
62 |
+ synchronized (user) { |
|
63 |
+ RecentlyVisitedProjects existingOne = find.where().eq("user", user).findUnique(); |
|
64 |
+ if(existingOne != null) { |
|
65 |
+ existingOne.add(project); |
|
66 |
+ existingOne.update(); |
|
67 |
+ return existingOne; |
|
68 |
+ } |
|
68 | 69 |
|
69 |
- RecentlyVisitedProjects newOne = new RecentlyVisitedProjects(); |
|
70 |
- newOne.user = user; |
|
71 |
- newOne.add(project); |
|
72 |
- newOne.save(); |
|
73 |
- return newOne; |
|
70 |
+ RecentlyVisitedProjects newOne = new RecentlyVisitedProjects(); |
|
71 |
+ newOne.user = user; |
|
72 |
+ newOne.add(project); |
|
73 |
+ newOne.save(); |
|
74 |
+ return newOne; |
|
75 |
+ } |
|
74 | 76 |
} |
75 | 77 |
|
76 | 78 |
private void add(Project project) { |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?