From 243e6ead83ddb8d637f898753fbf6be709a3e050 Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Wed, 28 Oct 2015 18:44:43 +0700 Subject: [PATCH 01/34] fix bug for sort score --- .../webapp/assets/modules/contest-detail/contestDetail.html | 5 ++--- .../assets/modules/contest-detail/contestDetailController.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetail.html b/src/main/webapp/assets/modules/contest-detail/contestDetail.html index 3a15638ec..ce7f9c440 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetail.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetail.html @@ -314,7 +314,6 @@

-
{{'qualifiedNextPhase' | translate}}
@@ -340,9 +339,9 @@

- + {{user.names}} - +

{{'disqualifyingReason' | translate}}: {{user.disqualifiedReason}}

diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index b8a7b4823..e8ac3acb5 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -62,7 +62,7 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l $scope.sortByScore = function () { $scope.sortByScoreType = $scope.sortByScoreType == "asc" ? "desc" : "asc"; - utils.sortByNumber($scope.registrantPhase, "score", $scope.sortByScoreType); + utils.sortByNumber($scope.registrantPhase, "savedTotalPoint", $scope.sortByScoreType); }; //$scope.sortBySubmissionDate = function () { From ef44e7ebcf34592a0cee897e80519f23f4b6d49b Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 09:53:55 +0700 Subject: [PATCH 02/34] update responsive --- src/main/webapp/assets/sass/contest-detail.sass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/assets/sass/contest-detail.sass b/src/main/webapp/assets/sass/contest-detail.sass index 158452ee9..c46cb3dec 100644 --- a/src/main/webapp/assets/sass/contest-detail.sass +++ b/src/main/webapp/assets/sass/contest-detail.sass @@ -361,7 +361,7 @@ a color: #2e6da4 .registration-review - width: 18% + width: 15% float: left text-align: center padding: 10px 0 @@ -375,7 +375,7 @@ clear: both display: inline-block .registrant-name - width: 35% + width: 41% float: left text-align: left padding: 10px @@ -408,7 +408,7 @@ i.closed background-color: #e6e6e6 .registration-date - width: 18% + width: 15% float: left text-align: center padding: 10px From b381fc8500fc876d4e644f0036ab97eaddee5e5f Mon Sep 17 00:00:00 2001 From: khoa-nd Date: Thu, 29 Oct 2015 10:05:10 +0700 Subject: [PATCH 03/34] Fix from job source issue on email JA --- .../com/techlooper/service/impl/JobAggregatorServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/techlooper/service/impl/JobAggregatorServiceImpl.java b/src/main/java/com/techlooper/service/impl/JobAggregatorServiceImpl.java index 3dbac3dad..7ce3ac286 100644 --- a/src/main/java/com/techlooper/service/impl/JobAggregatorServiceImpl.java +++ b/src/main/java/com/techlooper/service/impl/JobAggregatorServiceImpl.java @@ -327,7 +327,7 @@ private void mapJobCrawlSource(JobSearchResponse jobSearchResponse) { if (StringUtils.isNotEmpty(job.getCrawlSource())) { String crawlSource = job.getCrawlSource(); StringTokenizer tokenizer = new StringTokenizer(crawlSource, "-"); - while (tokenizer.hasMoreTokens()) { + if (tokenizer.hasMoreTokens()) { String sourceName = tokenizer.nextToken(); job.setCrawlSource(sourceName.toUpperCase()); } From ec1676479ac619ab869f54f278136ef46f6eeab7 Mon Sep 17 00:00:00 2001 From: Phuong H Date: Thu, 29 Oct 2015 10:05:57 +0700 Subject: [PATCH 04/34] Able to update registrent number in funnel --- .../contest-detail/contestDetailController.js | 88 ++----------------- .../contest-detail/contestDetailDirective.js | 5 +- 2 files changed, 11 insertions(+), 82 deletions(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index e8ac3acb5..b31ec1466 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -65,11 +65,6 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l utils.sortByNumber($scope.registrantPhase, "savedTotalPoint", $scope.sortByScoreType); }; - //$scope.sortBySubmissionDate = function () { - // $scope.sortByRegistrationDateType = $scope.sortByRegistrationDateType == "asc" ? "desc" : "asc"; - // utils.sortByNumber($scope.registrantPhase, "challengeSubmissionId", $scope.sortBySubmissionDateType); - //} - $scope.reviewPhase(); $scope.failJoin = false; @@ -158,12 +153,13 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l localStorageService.set("joinContests", joinContests.join(",")); $filter("progress")($scope.contestDetail, "challenge"); - $scope.filterContestant(); + //$scope.filterContestant(); }) .error(function () { $scope.failJoin = true; }); } + apiService.getContestDetail(contestId) .success(function (data) { $scope.contestDetail = data; @@ -216,81 +212,6 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l $scope.sortKey = keyname; //set the sortKey to the param passed $scope.reverse = !$scope.reverse; //if true make it false and vice versa }; - //$scope.filterContestant = function () { - // utils.sendNotification(jsonValue.notifications.loading); - // var param = $location.search(); - // var registrantFilterCondition = {}; - // registrantFilterCondition.challengeId = contestId; - // - // if ($scope.filterType) { - // registrantFilterCondition.filterType = $scope.filterType; - // } else if (param.filterType) { - // registrantFilterCondition.filterType = param.filterType; - // $scope.filterType = param.filterType; - // } else { - // registrantFilterCondition.filterType = "registrantId"; - // } - // - // if ($scope.phase) { - // registrantFilterCondition.phase = $scope.phase; - // } else if (param.phase) { - // registrantFilterCondition.phase = param.phase; - // $scope.phase = param.phase; - // } else { - // registrantFilterCondition.phase = ""; - // } - // - // if ($scope.fromDate) { - // registrantFilterCondition.fromDate = $scope.fromDate; - // } else { - // registrantFilterCondition.fromDate = param.fromDate; - // $scope.fromDate = param.fromDate; - // } - // - // if ($scope.toDate) { - // registrantFilterCondition.toDate = $scope.toDate; - // } else { - // registrantFilterCondition.toDate = param.toDate; - // $scope.toDate = param.toDate - // } - // - // apiService.getChallengeRegistrants(registrantFilterCondition) - // .success(function (registrants) { - // $scope.registrants = registrants; - // //$scope.sortByStartDate(); - // if (param.a == "registrants") { - // var registrantTab = $('.nav-tabs a[href=".registrants"]'); - // if (registrantTab) { - // registrantTab.tab('show'); - // } - // } - // }).finally(function () { - // utils.sendNotification(jsonValue.notifications.loaded); - // }); - //}; - // - //$scope.filterContestant(); - - - // - //$scope.sortByStartDate = function () { - // delete $scope.sortScore; - // $scope.sortStartDate = $scope.sortStartDate || "asc"; - // $scope.sortStartDate = $(["asc", "desc"]).not([$scope.sortStartDate]).get()[0]; - // utils.sortByNumber($scope.registrants, "registrantId", $scope.sortStartDate); - //} - - //$scope.updateScore = function (registrant, $event) { - // $($event.currentTarget).addClass('green'); - // apiService.saveChallengeRegistrant(registrant) - // .success(function (rt) { - // registrant.score = rt.score; - // }).finally(function () { - // $timeout(function () { - // $($event.currentTarget).removeClass('green'); - // }, 1000); - // }); - //} $scope.config = { registrantsFilter: resourcesService.registrantsFilterConfig, @@ -311,5 +232,10 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l $scope.contestDetail.saveCriteria(); } + + $scope.$on("update-funnel", function(sc, registrant) { + //console.log(registrant); + $scope.getRegistrants(registrant.challengeId); + }); }); diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailDirective.js b/src/main/webapp/assets/modules/contest-detail/contestDetailDirective.js index 4548b3a6b..31083bbb9 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailDirective.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailDirective.js @@ -53,7 +53,10 @@ techlooper scope.registrant.activePhase = scope.challenge.nextPhase; apiService.saveChallengeRegistrant(scope.registrant) .success(function() { - apiService.acceptChallengeRegistrant(scope.registrant.registrantId); + apiService.acceptChallengeRegistrant(scope.registrant.registrantId) + .success(function(registrant) { + $rootScope.$broadcast("update-funnel", registrant); + }); }); scope.registrant.qualified = true; delete scope.registrant.visible; From 1de3a615949b7d34fd197a0355dbf747bad1ac9f Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 10:27:03 +0700 Subject: [PATCH 05/34] active current phase for FUNNEL tab content --- .../assets/modules/contest-detail/contestDetailController.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index b31ec1466..35e5110c3 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -194,6 +194,7 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l $scope.registrantFunnel.currentPosition = i; } }); + $scope.selectedPhase = $scope.registrantFunnel.currentPosition; }).error(function () { console.log('error'); }); From e740ad5077e17d8cb2acbfb72e76ff1e3190403a Mon Sep 17 00:00:00 2001 From: khoa-nd Date: Thu, 29 Oct 2015 10:38:01 +0700 Subject: [PATCH 06/34] Try to fix cron job run twice to send duplicated email --- .../web/DispatcherServletInitializer.java | 57 ++++++++++--------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/techlooper/config/web/DispatcherServletInitializer.java b/src/main/java/com/techlooper/config/web/DispatcherServletInitializer.java index 83c80f873..b456edda6 100644 --- a/src/main/java/com/techlooper/config/web/DispatcherServletInitializer.java +++ b/src/main/java/com/techlooper/config/web/DispatcherServletInitializer.java @@ -34,30 +34,35 @@ public class DispatcherServletInitializer extends AbstractAnnotationConfigDispat // @Value("${spring.profiles.active}") // private String profile; - public void onStartup(ServletContext servletContext) throws ServletException { - super.onStartup(servletContext); - servletContext.getSessionCookieConfig().setMaxAge(15770000); - servletContext.addListener(new SessionListener()); - } - - protected Class[] getRootConfigClasses() { - return null; - } - - protected Class[] getServletConfigClasses() { - return new Class[]{ - CoreConfiguration.class, - VnwDbConfiguration.class, - WebConfiguration.class, - SecurityConfiguration.class - }; - } - - protected String[] getServletMappings() { - return new String[]{"/"}; - } - - protected void customizeRegistration(Dynamic registration) { - registration.setInitParameter("dispatchOptionsRequest", "true"); - } + public void onStartup(ServletContext servletContext) throws ServletException { + super.onStartup(servletContext); + servletContext.getSessionCookieConfig().setMaxAge(15770000); + servletContext.addListener(new SessionListener()); + } + + protected Class[] getRootConfigClasses() { + return null; + } + + protected Class[] getServletConfigClasses() { + return new Class[]{ + CoreConfiguration.class, + VnwDbConfiguration.class, + WebConfiguration.class, + SecurityConfiguration.class + }; + } + + protected String[] getServletMappings() { + return new String[]{"/"}; + } + + protected void customizeRegistration(Dynamic registration) { + registration.setInitParameter("dispatchOptionsRequest", "true"); + } + + @Override + protected void registerContextLoaderListener(ServletContext servletContext) { + + } } From 1bbbde575493aaadb966ba7cc782f8c4d8b7643b Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 10:43:33 +0700 Subject: [PATCH 07/34] update responsive and tooltip for qualify and disqualify function --- .../webapp/assets/modules/contest-detail/contestDetail.html | 5 +++-- .../assets/modules/contest-detail/contestDetailController.js | 2 +- src/main/webapp/assets/modules/translation/messages_en.json | 2 ++ src/main/webapp/assets/modules/translation/messages_vi.json | 2 ++ src/main/webapp/assets/sass/contest-detail.sass | 3 +++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetail.html b/src/main/webapp/assets/modules/contest-detail/contestDetail.html index ce7f9c440..dfedbb932 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetail.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetail.html @@ -363,8 +363,8 @@

- - + +
@@ -387,6 +387,7 @@

+ diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index 35e5110c3..5c2a7b009 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -17,7 +17,7 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l } $scope.reviewPhase = function (index, phase) { - utils.sendNotification(jsonValue.notifications.loading); + //utils.sendNotification(jsonValue.notifications.loading); if (index) { $scope.selectedPhase = index; } diff --git a/src/main/webapp/assets/modules/translation/messages_en.json b/src/main/webapp/assets/modules/translation/messages_en.json index b713b4211..efff02993 100644 --- a/src/main/webapp/assets/modules/translation/messages_en.json +++ b/src/main/webapp/assets/modules/translation/messages_en.json @@ -827,6 +827,8 @@ "PhaseDes": "Select which contestants are qualified for the next round:", "lastSubmissionDate": "Last Submission Date", "qualifiedNextPhase": "Qualified to next round?", + "qualifyNextPhase": "Qualify to next round?", + "disqualifyNextPhase": "Disqualify to next round?", "disqualified": "Disqualified", "qualified": "Qualified", "submissionToPhase": "Submission to phase:", diff --git a/src/main/webapp/assets/modules/translation/messages_vi.json b/src/main/webapp/assets/modules/translation/messages_vi.json index b3d651a1e..15b773f25 100644 --- a/src/main/webapp/assets/modules/translation/messages_vi.json +++ b/src/main/webapp/assets/modules/translation/messages_vi.json @@ -831,6 +831,8 @@ "PhaseDes": "Lựa chọn các thí sinh cho vòng tiếp theo:", "lastSubmissionDate": "Ngày gửi bài gần nhất", "qualifiedNextPhase": "Đạt điều kiện vào vòng sau?", + "qualifyNextPhase": "Đạt điều kiện vào vòng sau?", + "disqualifyNextPhase": "Không đạt điều kiện vào vòng sau?", "disqualified": "Không đạt", "qualified": "Đạt", "submissionToPhase": "Gửi vào giai đoạn:", diff --git a/src/main/webapp/assets/sass/contest-detail.sass b/src/main/webapp/assets/sass/contest-detail.sass index c46cb3dec..ea039c1e0 100644 --- a/src/main/webapp/assets/sass/contest-detail.sass +++ b/src/main/webapp/assets/sass/contest-detail.sass @@ -370,6 +370,8 @@ width: 50% text-align: center display: inline + font-size: 18px + padding: 0 5px a.dis width: 100% clear: both @@ -1145,6 +1147,7 @@ width: 100% clear: both padding: 10px 0 0 0 + position: relative .alert margin-top: 20px .evaluation-criteria From 8ba8c997c41978a88b0b06c76e8d16e2d917348d Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 10:54:45 +0700 Subject: [PATCH 08/34] fix bug style css --- src/main/webapp/assets/sass/contest-detail.sass | 2 +- src/main/webapp/assets/sass/contests.sass | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/assets/sass/contest-detail.sass b/src/main/webapp/assets/sass/contest-detail.sass index ea039c1e0..bc1be1371 100644 --- a/src/main/webapp/assets/sass/contest-detail.sass +++ b/src/main/webapp/assets/sass/contest-detail.sass @@ -821,7 +821,7 @@ a margin: auto auto auto 5px .submit-phase-contest.show - height: 280px + height: 310px background-color: #f1f2f7 transition: height 1s padding: 10px 20px diff --git a/src/main/webapp/assets/sass/contests.sass b/src/main/webapp/assets/sass/contests.sass index 83275b730..b15245048 100644 --- a/src/main/webapp/assets/sass/contests.sass +++ b/src/main/webapp/assets/sass/contests.sass @@ -262,7 +262,7 @@ margin-top: 10px position: relative .submit-phase-contest.show - height: 280px + height: 310px background-color: #f1f2f7 transition: height 1s padding: 10px 20px From 1a3f7bfd88f2c576e4f1009f832e310484c2809c Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 11:00:44 +0700 Subject: [PATCH 09/34] update discription tooltip for qualify registrant --- .../modules/contest-detail/contestDetailQualification.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailQualification.html b/src/main/webapp/assets/modules/contest-detail/contestDetailQualification.html index 6b191e752..a69d0f3fa 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailQualification.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailQualification.html @@ -1,6 +1,7 @@
-

+

From 04599d6109c8191d21f1c1061021de87a3f0ffeb Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 11:50:09 +0700 Subject: [PATCH 10/34] add close for submission date --- .../contest-detail/contestDetailReviewSubmission.html | 4 ++++ src/main/webapp/assets/sass/contest-detail.sass | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html b/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html index ad1473cf5..aad1272be 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html @@ -8,6 +8,9 @@
+
+ x +
+
diff --git a/src/main/webapp/assets/sass/contest-detail.sass b/src/main/webapp/assets/sass/contest-detail.sass index bc1be1371..54c4eb2a0 100644 --- a/src/main/webapp/assets/sass/contest-detail.sass +++ b/src/main/webapp/assets/sass/contest-detail.sass @@ -501,7 +501,7 @@ width: 80% float: left .subject-col - width: 40% + width: 35% float: left text-align: left word-break: break-all @@ -519,6 +519,15 @@ width: 10% float: left text-align: right + .close-col + width: 5% + float: left + text-align: right + cursor: pointer + font-weight: 500 + padding-right: 5px + span.close-box + padding-top: 0px .header-row width: 100% font-weight: 400 From 3d47cc92c3583095b4a94c07323486376f9501d4 Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 11:57:37 +0700 Subject: [PATCH 11/34] add loading for switch phase --- .../modules/contest-detail/contestDetail.html | 89 +------------------ .../contest-detail/contestDetailController.js | 7 +- .../webapp/assets/sass/contest-detail.sass | 1 + 3 files changed, 8 insertions(+), 89 deletions(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetail.html b/src/main/webapp/assets/modules/contest-detail/contestDetail.html index dfedbb932..e4e42fb4e 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetail.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetail.html @@ -387,100 +387,13 @@

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index 5c2a7b009..45e5aba1c 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -1,5 +1,5 @@ techlooper.controller('contestDetailController', function ($scope, apiService, localStorageService, $location, $routeParams, - jsonValue, $translate, utils, $filter, $timeout, resourcesService) { + jsonValue, $translate, utils, $filter, $timeout, resourcesService, $timeout) { utils.sendNotification(jsonValue.notifications.loading); $scope.selectedPhase = 0; @@ -18,6 +18,7 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l $scope.reviewPhase = function (index, phase) { //utils.sendNotification(jsonValue.notifications.loading); + $('.feedback-loading').css('visibility', 'inherit'); if (index) { $scope.selectedPhase = index; } @@ -47,6 +48,10 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l } }).finally(function () { utils.sendNotification(jsonValue.notifications.loaded); + $timeout(function () { + $('.feedback-loading').css('visibility', 'hidden'); + scope.cancel(); + }, 1200); }); }; diff --git a/src/main/webapp/assets/sass/contest-detail.sass b/src/main/webapp/assets/sass/contest-detail.sass index 54c4eb2a0..2adaa1f9f 100644 --- a/src/main/webapp/assets/sass/contest-detail.sass +++ b/src/main/webapp/assets/sass/contest-detail.sass @@ -254,6 +254,7 @@ border: 1px solid #ddd border-top: 0 padding: 20px 0 + position: relative .label-col display: none .detail From f50e7510ff31e3e7160b6a4f1ab468ca86024a8c Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 13:14:29 +0700 Subject: [PATCH 12/34] unclick for phase in the future + 1 --- .../common/feedback/feedbackDirective.js | 2 +- .../modules/contest-detail/contestDetail.html | 2 +- .../contest-detail/contestDetailController.js | 27 ++++++++++++------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main/webapp/assets/modules/common/feedback/feedbackDirective.js b/src/main/webapp/assets/modules/common/feedback/feedbackDirective.js index 60601ecb7..3c3d44ea2 100644 --- a/src/main/webapp/assets/modules/common/feedback/feedbackDirective.js +++ b/src/main/webapp/assets/modules/common/feedback/feedbackDirective.js @@ -4,7 +4,7 @@ techlooper.directive("feedbackForm", function (apiService, $timeout) { replace: true, templateUrl: "modules/common/feedback/feedback.html", scope: { - composeEmail: "=", + composeEmail: "=" }, link: function (scope, element, attr, ctrl, composeEmail) { if (scope.composeEmail.registrantLastName) { diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetail.html b/src/main/webapp/assets/modules/contest-detail/contestDetail.html index e4e42fb4e..33a43a1b1 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetail.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetail.html @@ -245,7 +245,7 @@

diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index 45e5aba1c..bbad351ff 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -2,7 +2,7 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l jsonValue, $translate, utils, $filter, $timeout, resourcesService, $timeout) { utils.sendNotification(jsonValue.notifications.loading); $scope.selectedPhase = 0; - + var activePhaseIndex = 0; var parts = $routeParams.id.split("-"); var lastPart = parts.pop(); if (parts.length < 2 || (lastPart !== "id")) { @@ -16,16 +16,20 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l return $location.url(sprintf("/challenge-detail/%s-%s-id", title, contestId)); } - $scope.reviewPhase = function (index, phase) { - //utils.sendNotification(jsonValue.notifications.loading); - $('.feedback-loading').css('visibility', 'inherit'); - if (index) { - $scope.selectedPhase = index; + $scope.reviewPhase = function (index, phase, nextPhase) { + var phaseName = phase ? phase.phase : jsonValue.challengePhase.getRegistration().enum; + if (index){ + if(index > activePhaseIndex+1){ + return; + }else{ + $('.feedback-loading').css('visibility', 'inherit'); + $scope.selectedPhase = index; + } } else { $scope.selectedPhase = 0; } - var phaseName = phase ? phase.phase : jsonValue.challengePhase.getRegistration().enum; + apiService.getChallengeRegistrantsByPhase(contestId, phaseName).success(function (data) { $scope.registrantPhase = data; @@ -50,7 +54,6 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l utils.sendNotification(jsonValue.notifications.loaded); $timeout(function () { $('.feedback-loading').css('visibility', 'hidden'); - scope.cancel(); }, 1200); }); }; @@ -70,8 +73,6 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l utils.sortByNumber($scope.registrantPhase, "savedTotalPoint", $scope.sortByScoreType); }; - $scope.reviewPhase(); - $scope.failJoin = false; $scope.action = ''; $scope.actionContent = ''; @@ -194,16 +195,22 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l apiService.getRegistrantFunnel(contestId) .success(function (data) { $scope.registrantFunnel = data; + console.log($scope.contestDetail); $.each($scope.registrantFunnel, function (i, item) { if (item.phase == $scope.contestDetail.currentPhase) { $scope.registrantFunnel.currentPosition = i; } }); + $scope.selectedPhase = $scope.registrantFunnel.currentPosition; + activePhaseIndex = $scope.registrantFunnel.currentPosition; + $scope.reviewPhase(); + }).error(function () { console.log('error'); }); } + $scope.fbShare = function () { ga("send", { hitType: "event", From b57c75ded7bdf3778c8595c3b4d2a30ae17e1bdc Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 13:33:44 +0700 Subject: [PATCH 13/34] fix bug loading --- .../assets/modules/contest-detail/contestDetail.html | 7 +++++-- .../modules/contest-detail/contestDetailController.js | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetail.html b/src/main/webapp/assets/modules/contest-detail/contestDetail.html index 33a43a1b1..77142ece0 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetail.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetail.html @@ -363,8 +363,11 @@

- - + + +
diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index bbad351ff..06f834a15 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -195,19 +195,17 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l apiService.getRegistrantFunnel(contestId) .success(function (data) { $scope.registrantFunnel = data; - console.log($scope.contestDetail); $.each($scope.registrantFunnel, function (i, item) { if (item.phase == $scope.contestDetail.currentPhase) { $scope.registrantFunnel.currentPosition = i; } }); - $scope.selectedPhase = $scope.registrantFunnel.currentPosition; activePhaseIndex = $scope.registrantFunnel.currentPosition; $scope.reviewPhase(); - }).error(function () { console.log('error'); + utils.sendNotification(jsonValue.notifications.loaded); }); } From e6cd9aa2b0b0861b04ddc8219afbb9e36bde8993 Mon Sep 17 00:00:00 2001 From: khoa-nd Date: Thu, 29 Oct 2015 13:37:19 +0700 Subject: [PATCH 14/34] Don't show the phase that doesn't belong to this challenge --- .../controller/ChallengeController.java | 276 +++++++++--------- .../techlooper/service/ChallengeService.java | 2 +- .../service/impl/ChallengeServiceImpl.java | 25 +- 3 files changed, 161 insertions(+), 142 deletions(-) diff --git a/src/main/java/com/techlooper/controller/ChallengeController.java b/src/main/java/com/techlooper/controller/ChallengeController.java index 594bf7a49..323c9d36a 100644 --- a/src/main/java/com/techlooper/controller/ChallengeController.java +++ b/src/main/java/com/techlooper/controller/ChallengeController.java @@ -28,154 +28,152 @@ @RestController public class ChallengeController { - private final static Logger LOGGER = LoggerFactory.getLogger(ChallengeController.class); - - @Resource - private ChallengeService challengeService; - - @Resource - private EmployerService employerService; - - @Resource - private LeadAPIService leadAPIService; - - @Resource - private ChallengeRegistrantRepository challengeRegistrantRepository; - - @Resource - private ChallengeRegistrantService challengeRegistrantService; - - @PreAuthorize("hasAuthority('EMPLOYER')") - @RequestMapping(value = "/challenge/publish", method = RequestMethod.POST) - public ChallengeResponse publishChallenge(@RequestBody ChallengeDto challengeDto, HttpServletRequest servletRequest) throws Exception { - int responseCode = 0; - String employerEmail = servletRequest.getRemoteUser(); - challengeDto.setAuthorEmail(employerEmail); - ChallengeEntity challengeEntity = challengeService.savePostChallenge(challengeDto); - boolean newEntity = challengeDto.getChallengeId() == null; - if (newEntity) { - if (challengeEntity != null) { - if (EmailValidator.validate(challengeEntity.getAuthorEmail())) { - challengeService.sendPostChallengeEmailToEmployer(challengeEntity); + private final static Logger LOGGER = LoggerFactory.getLogger(ChallengeController.class); + + @Resource + private ChallengeService challengeService; + + @Resource + private EmployerService employerService; + + @Resource + private LeadAPIService leadAPIService; + + @Resource + private ChallengeRegistrantRepository challengeRegistrantRepository; + + @Resource + private ChallengeRegistrantService challengeRegistrantService; + + @PreAuthorize("hasAuthority('EMPLOYER')") + @RequestMapping(value = "/challenge/publish", method = RequestMethod.POST) + public ChallengeResponse publishChallenge(@RequestBody ChallengeDto challengeDto, HttpServletRequest servletRequest) throws Exception { + int responseCode = 0; + String employerEmail = servletRequest.getRemoteUser(); + challengeDto.setAuthorEmail(employerEmail); + ChallengeEntity challengeEntity = challengeService.savePostChallenge(challengeDto); + boolean newEntity = challengeDto.getChallengeId() == null; + if (newEntity) { + if (challengeEntity != null) { + if (EmailValidator.validate(challengeEntity.getAuthorEmail())) { + challengeService.sendPostChallengeEmailToEmployer(challengeEntity); + } + challengeService.sendPostChallengeEmailToTechloopies(challengeEntity, Boolean.TRUE); + } + + // Call Lead Management API to create new lead on CRM system + try { + VnwUser employer = employerService.findEmployerByUsername(employerEmail); + VnwCompany company = employerService.findCompanyById(employer.getCompanyId()); + if (employer != null && company != null) { + responseCode = leadAPIService.createNewLead( + employer, company, LeadEventEnum.POST_CHALLENGE, challengeEntity.getChallengeName()); + + String logMessage = "Create Lead API Response Code : %d ,EmployerID : %d ,CompanyID : %d"; + LOGGER.info(String.format(logMessage, responseCode, employer.getUserId(), company.getCompanyId())); + } + } catch (Exception ex) { + LOGGER.error(ex.getMessage(), ex); + } + } else { + challengeService.sendPostChallengeEmailToTechloopies(challengeEntity, Boolean.FALSE); } - challengeService.sendPostChallengeEmailToTechloopies(challengeEntity, Boolean.TRUE); - } - - // Call Lead Management API to create new lead on CRM system - try { - VnwUser employer = employerService.findEmployerByUsername(employerEmail); - VnwCompany company = employerService.findCompanyById(employer.getCompanyId()); - if (employer != null && company != null) { - responseCode = leadAPIService.createNewLead( - employer, company, LeadEventEnum.POST_CHALLENGE, challengeEntity.getChallengeName()); - - String logMessage = "Create Lead API Response Code : %d ,EmployerID : %d ,CompanyID : %d"; - LOGGER.info(String.format(logMessage, responseCode, employer.getUserId(), company.getCompanyId())); + + return new ChallengeResponse(challengeEntity.getChallengeId(), responseCode); + } + + @RequestMapping(value = "/challenge/{challengeId}", method = RequestMethod.GET) + public ChallengeDetailDto getChallengeDetail(@PathVariable Long challengeId, HttpServletRequest request, HttpServletResponse response) throws Exception { + ChallengeDetailDto challengeDetail = challengeService.getChallengeDetail(challengeId, request.getRemoteUser()); + if (challengeDetail == null) response.setStatus(HttpServletResponse.SC_NOT_FOUND); + return challengeDetail; + } + + @RequestMapping(value = "/challenge/join", method = RequestMethod.POST) + public long joinChallenge(@RequestBody ChallengeRegistrantDto joinChallenge, HttpServletResponse response) throws Exception { + if (!EmailValidator.validate(joinChallenge.getRegistrantEmail())) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + return 0L; } - } - catch (Exception ex) { - LOGGER.error(ex.getMessage(), ex); - } + return challengeService.joinChallenge(joinChallenge); } - else { - challengeService.sendPostChallengeEmailToTechloopies(challengeEntity, Boolean.FALSE); + + @RequestMapping(value = "/challenge/list", method = RequestMethod.GET) + public List listChallenges() throws Exception { + return challengeService.listChallenges(); + } + + @RequestMapping(value = "/challenge/stats", method = RequestMethod.GET) + public ChallengeStatsDto getChallengeStatistics() throws Exception { + ChallengeStatsDto challengeStatsDto = new ChallengeStatsDto(); + challengeStatsDto.setNumberOfChallenges(challengeService.getTotalNumberOfChallenges()); + challengeStatsDto.setNumberOfRegistrants(challengeService.getTotalNumberOfRegistrants()); + challengeStatsDto.setTotalPrizeAmount(challengeService.getTotalAmountOfPrizeValues()); + return challengeStatsDto; + } + + @PreAuthorize("hasAuthority('EMPLOYER')") + @RequestMapping(value = "/challenge/{id}", method = RequestMethod.DELETE) + public void deleteChallengeById(@PathVariable Long id, HttpServletRequest request, HttpServletResponse response) { + if (!challengeService.delete(id, request.getRemoteUser())) { + response.setStatus(HttpServletResponse.SC_FORBIDDEN); + } } - return new ChallengeResponse(challengeEntity.getChallengeId(), responseCode); - } - - @RequestMapping(value = "/challenge/{challengeId}", method = RequestMethod.GET) - public ChallengeDetailDto getChallengeDetail(@PathVariable Long challengeId, HttpServletRequest request, HttpServletResponse response) throws Exception { - ChallengeDetailDto challengeDetail = challengeService.getChallengeDetail(challengeId, request.getRemoteUser()); - if (challengeDetail == null) response.setStatus(HttpServletResponse.SC_NOT_FOUND); - return challengeDetail; - } - - @RequestMapping(value = "/challenge/join", method = RequestMethod.POST) - public long joinChallenge(@RequestBody ChallengeRegistrantDto joinChallenge, HttpServletResponse response) throws Exception { - if (!EmailValidator.validate(joinChallenge.getRegistrantEmail())) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return 0L; + @RequestMapping(value = "/challenges/{challengeId}", method = RequestMethod.GET) + public ChallengeDto findChallengeById(@PathVariable Long challengeId, HttpServletRequest request) throws Exception { + return challengeService.findChallengeById(challengeId, request.getRemoteUser()); } - return challengeService.joinChallenge(joinChallenge); - } - - @RequestMapping(value = "/challenge/list", method = RequestMethod.GET) - public List listChallenges() throws Exception { - return challengeService.listChallenges(); - } - - @RequestMapping(value = "/challenge/stats", method = RequestMethod.GET) - public ChallengeStatsDto getChallengeStatistics() throws Exception { - ChallengeStatsDto challengeStatsDto = new ChallengeStatsDto(); - challengeStatsDto.setNumberOfChallenges(challengeService.getTotalNumberOfChallenges()); - challengeStatsDto.setNumberOfRegistrants(challengeService.getTotalNumberOfRegistrants()); - challengeStatsDto.setTotalPrizeAmount(challengeService.getTotalAmountOfPrizeValues()); - return challengeStatsDto; - } - - @PreAuthorize("hasAuthority('EMPLOYER')") - @RequestMapping(value = "/challenge/{id}", method = RequestMethod.DELETE) - public void deleteChallengeById(@PathVariable Long id, HttpServletRequest request, HttpServletResponse response) { - if (!challengeService.delete(id, request.getRemoteUser())) { - response.setStatus(HttpServletResponse.SC_FORBIDDEN); + + @PreAuthorize("hasAuthority('EMPLOYER')") + @RequestMapping(value = "/challenges/{challengeId}/registrants", method = RequestMethod.POST) + public Set getRegistrantsById(@PathVariable Long challengeId, @RequestBody RegistrantFilterCondition condition, + HttpServletRequest request, HttpServletResponse response) throws ParseException { + String owner = request.getRemoteUser(); + if (!challengeService.isOwnerOfChallenge(owner, challengeId)) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + return null; + } + condition.setAuthorEmail(owner); + return challengeService.findRegistrantsByOwner(condition); } - } - - @RequestMapping(value = "/challenges/{challengeId}", method = RequestMethod.GET) - public ChallengeDto findChallengeById(@PathVariable Long challengeId, HttpServletRequest request) throws Exception { - return challengeService.findChallengeById(challengeId, request.getRemoteUser()); - } - - @PreAuthorize("hasAuthority('EMPLOYER')") - @RequestMapping(value = "/challenges/{challengeId}/registrants", method = RequestMethod.POST) - public Set getRegistrantsById(@PathVariable Long challengeId, @RequestBody RegistrantFilterCondition condition, - HttpServletRequest request, HttpServletResponse response) throws ParseException { - String owner = request.getRemoteUser(); - if (!challengeService.isOwnerOfChallenge(owner, challengeId)) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return null; + + + @PreAuthorize("hasAuthority('EMPLOYER')") + @RequestMapping(value = "/challengeDetail/registrant", method = RequestMethod.POST) + public ChallengeRegistrantDto saveRegistrant(@RequestBody ChallengeRegistrantDto dto, HttpServletRequest request) { + return challengeService.saveRegistrant(request.getRemoteUser(), dto); } - condition.setAuthorEmail(owner); - return challengeService.findRegistrantsByOwner(condition); - } - - - @PreAuthorize("hasAuthority('EMPLOYER')") - @RequestMapping(value = "/challengeDetail/registrant", method = RequestMethod.POST) - public ChallengeRegistrantDto saveRegistrant(@RequestBody ChallengeRegistrantDto dto, HttpServletRequest request) { - return challengeService.saveRegistrant(request.getRemoteUser(), dto); - } - - @PreAuthorize("hasAuthority('EMPLOYER')") - @RequestMapping(value = "challengeRegistrant/fullName/{registrantId}", method = RequestMethod.GET) - public String getChallengeRegistrant(@PathVariable Long registrantId) { - ChallengeRegistrantEntity registrantEntity = challengeRegistrantRepository.findOne(registrantId); - return registrantEntity.getRegistrantFirstName() + " " + registrantEntity.getRegistrantLastName(); - } - - @PreAuthorize("hasAuthority('EMPLOYER')") - @RequestMapping(value = "/challenges/{challengeId}/registrantFunnel", method = RequestMethod.GET) - public List getChallengeRegistrantFunnel(@PathVariable Long challengeId, - HttpServletRequest request, HttpServletResponse response) { - List funnel = new ArrayList<>(); - if (challengeService.isOwnerOfChallenge(request.getRemoteUser(), challengeId)) { - funnel = challengeService.getChallengeRegistrantFunnel(challengeId); + + @PreAuthorize("hasAuthority('EMPLOYER')") + @RequestMapping(value = "challengeRegistrant/fullName/{registrantId}", method = RequestMethod.GET) + public String getChallengeRegistrant(@PathVariable Long registrantId) { + ChallengeRegistrantEntity registrantEntity = challengeRegistrantRepository.findOne(registrantId); + return registrantEntity.getRegistrantFirstName() + " " + registrantEntity.getRegistrantLastName(); } - else { - response.setStatus(HttpServletResponse.SC_FORBIDDEN); + + @PreAuthorize("hasAuthority('EMPLOYER')") + @RequestMapping(value = "/challenges/{challengeId}/registrantFunnel", method = RequestMethod.GET) + public List getChallengeRegistrantFunnel(@PathVariable Long challengeId, + HttpServletRequest request, HttpServletResponse response) { + List funnel = new ArrayList<>(); + String ownerEmail = request.getRemoteUser(); + if (challengeService.isOwnerOfChallenge(ownerEmail, challengeId)) { + funnel = challengeService.getChallengeRegistrantFunnel(challengeId, ownerEmail); + } else { + response.setStatus(HttpServletResponse.SC_FORBIDDEN); + } + return funnel; } - return funnel; - } - - @PreAuthorize("hasAuthority('EMPLOYER')") - @RequestMapping(value = "challenge/{challengeId}/registrants/{phase}", method = RequestMethod.GET) - public Set getChallengeRegistrantsByPhase(@PathVariable Long challengeId, @PathVariable ChallengePhaseEnum phase, - HttpServletRequest request, HttpServletResponse response) { - Set registrants = challengeRegistrantService.findRegistrantsByChallengeIdAndPhase(challengeId, phase, request.getRemoteUser()); - if (registrants == null) { - response.setStatus(HttpServletResponse.SC_FORBIDDEN); + + @PreAuthorize("hasAuthority('EMPLOYER')") + @RequestMapping(value = "challenge/{challengeId}/registrants/{phase}", method = RequestMethod.GET) + public Set getChallengeRegistrantsByPhase(@PathVariable Long challengeId, @PathVariable ChallengePhaseEnum phase, + HttpServletRequest request, HttpServletResponse response) { + Set registrants = challengeRegistrantService.findRegistrantsByChallengeIdAndPhase(challengeId, phase, request.getRemoteUser()); + if (registrants == null) { + response.setStatus(HttpServletResponse.SC_FORBIDDEN); + } + return registrants; } - return registrants; - } } diff --git a/src/main/java/com/techlooper/service/ChallengeService.java b/src/main/java/com/techlooper/service/ChallengeService.java index a35e5ead7..8dccc08d8 100644 --- a/src/main/java/com/techlooper/service/ChallengeService.java +++ b/src/main/java/com/techlooper/service/ChallengeService.java @@ -107,5 +107,5 @@ List findChallengeSubmissionWithinPeriod( ChallengeRegistrantEntity findRegistrantByChallengeIdAndEmail(Long challengeId, String email); - List getChallengeRegistrantFunnel(Long challengeId); + List getChallengeRegistrantFunnel(Long challengeId, String ownerEmail); } diff --git a/src/main/java/com/techlooper/service/impl/ChallengeServiceImpl.java b/src/main/java/com/techlooper/service/impl/ChallengeServiceImpl.java index 16e2edf8c..893545c31 100644 --- a/src/main/java/com/techlooper/service/impl/ChallengeServiceImpl.java +++ b/src/main/java/com/techlooper/service/impl/ChallengeServiceImpl.java @@ -1010,8 +1010,9 @@ public ChallengeRegistrantDto acceptRegistrant(String ownerEmail, Long registran } @Override - public List getChallengeRegistrantFunnel(Long challengeId) { + public List getChallengeRegistrantFunnel(Long challengeId, String ownerEmail) { List funnel = new ArrayList<>(); + ChallengeDto challengeDto = findChallengeById(challengeId, ownerEmail); Map numberOfRegistrantsByPhase = challengeRegistrantService.countNumberOfRegistrantsByPhase(challengeId); Map numberOfSubmissionsByPhase = @@ -1024,7 +1025,10 @@ public List getChallengeRegistrantFunnel(Long cha if (numberOfSubmissionsByPhase.get(phase) != null) { submission = numberOfSubmissionsByPhase.get(phase).getSubmission(); } - funnel.add(new ChallengeRegistrantFunnelItem(phase, participant, submission)); + + if (isValidPhase(challengeDto, phase)) { + funnel.add(new ChallengeRegistrantFunnelItem(phase, participant, submission)); + } } // Long numberOfWinners = challengeRegistrantService.countNumberOfWinners(challengeId); @@ -1034,4 +1038,21 @@ public List getChallengeRegistrantFunnel(Long cha item1.getPhase().getOrder() - item2.getPhase().getOrder(); return funnel.stream().sorted(sortByPhaseComparator).collect(toList()); } + + private boolean isValidPhase(ChallengeDto challengeDto, ChallengePhaseEnum phase) { + switch (phase) { + case REGISTRATION: + return StringUtils.isNotEmpty(challengeDto.getRegistrationDate()); + case IDEA: + return StringUtils.isNotEmpty(challengeDto.getIdeaSubmissionDate()); + case UIUX: + return StringUtils.isNotEmpty(challengeDto.getUxSubmissionDate()); + case PROTOTYPE: + return StringUtils.isNotEmpty(challengeDto.getPrototypeSubmissionDate()); + case FINAL: + return StringUtils.isNotEmpty(challengeDto.getSubmissionDate()); + default: + return false; + } + } } From 5402c4dd5eee70870450ae1c9e905aa6c429f7d2 Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 13:40:32 +0700 Subject: [PATCH 15/34] fix bug active default current phase --- .../assets/modules/contest-detail/contestDetailController.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index 06f834a15..dd1de2fe0 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -26,9 +26,6 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l $scope.selectedPhase = index; } } - else { - $scope.selectedPhase = 0; - } apiService.getChallengeRegistrantsByPhase(contestId, phaseName).success(function (data) { $scope.registrantPhase = data; @@ -205,7 +202,7 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l $scope.reviewPhase(); }).error(function () { console.log('error'); - utils.sendNotification(jsonValue.notifications.loaded); + utils.sendNotification(jsonValue.notifications.loaded); }); } From 13f4a0ba47997aea3d3f727eddc277ab449ce17b Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 13:56:01 +0700 Subject: [PATCH 16/34] fix bug loading --- .../modules/contest-detail/contestDetail.html | 2 +- .../contest-detail/contestDetailController.js | 14 +++++--------- src/main/webapp/assets/sass/contest-detail.sass | 2 ++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetail.html b/src/main/webapp/assets/modules/contest-detail/contestDetail.html index 77142ece0..a367ff8c9 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetail.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetail.html @@ -246,7 +246,7 @@

+ ng-class="{col3: registrantFunnel.length == 3, col4: registrantFunnel.length == 4, col5: registrantFunnel.length == 5, col6: registrantFunnel.length == 6, active: $index == selectedPhase}">
diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js index dd1de2fe0..ddc0c94bc 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailController.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailController.js @@ -18,15 +18,12 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l $scope.reviewPhase = function (index, phase, nextPhase) { var phaseName = phase ? phase.phase : jsonValue.challengePhase.getRegistration().enum; - if (index){ - if(index > activePhaseIndex+1){ + if (index && index > activePhaseIndex+1){ return; - }else{ - $('.feedback-loading').css('visibility', 'inherit'); - $scope.selectedPhase = index; - } + }else{ + $('.feedback-loading').css('visibility', 'inherit'); + $scope.selectedPhase = index; } - apiService.getChallengeRegistrantsByPhase(contestId, phaseName).success(function (data) { $scope.registrantPhase = data; @@ -199,13 +196,12 @@ techlooper.controller('contestDetailController', function ($scope, apiService, l }); $scope.selectedPhase = $scope.registrantFunnel.currentPosition; activePhaseIndex = $scope.registrantFunnel.currentPosition; - $scope.reviewPhase(); }).error(function () { console.log('error'); utils.sendNotification(jsonValue.notifications.loaded); }); } - + $scope.reviewPhase(); $scope.fbShare = function () { ga("send", { hitType: "event", diff --git a/src/main/webapp/assets/sass/contest-detail.sass b/src/main/webapp/assets/sass/contest-detail.sass index 2adaa1f9f..69da862e9 100644 --- a/src/main/webapp/assets/sass/contest-detail.sass +++ b/src/main/webapp/assets/sass/contest-detail.sass @@ -1147,6 +1147,8 @@ color: #257abb .current-phase.winner color: #FFAA00 + .challenge-phase-item.col3 + width: 33.3339% .challenge-phase-item.col4 width: 25% .challenge-phase-item.col5 From 9e5a0e1e21e41d682461b626ea5283c3a44d3ac2 Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 14:09:16 +0700 Subject: [PATCH 17/34] hide registrant = 0 --- .../webapp/assets/modules/contest-detail/contestDetail.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetail.html b/src/main/webapp/assets/modules/contest-detail/contestDetail.html index a367ff8c9..2a33d143e 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetail.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetail.html @@ -264,7 +264,7 @@

+ translate-value-number="{{phase.participant}}" ng-show="phase.participant > 0 && ((phase.phase | progress: 'challengePhaseTitle' | lowercase) == 'registration')">

- From c70c5356212ebf21b4a405f28783ea7690b95111 Mon Sep 17 00:00:00 2001 From: khoa-nd Date: Thu, 29 Oct 2015 14:16:47 +0700 Subject: [PATCH 18/34] Fix the "Review All Submissions" link in daily challenge email --- src/main/resources/template/challengeDailySummary.en.ftl | 2 +- src/main/resources/template/challengeDailySummary.vi.ftl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/template/challengeDailySummary.en.ftl b/src/main/resources/template/challengeDailySummary.en.ftl index a94527000..2a74e49eb 100644 --- a/src/main/resources/template/challengeDailySummary.en.ftl +++ b/src/main/resources/template/challengeDailySummary.en.ftl @@ -341,7 +341,7 @@
- Review All + Xem Tất Cả Bài Gửi
diff --git a/src/main/resources/template/challengeDailySummary.vi.ftl b/src/main/resources/template/challengeDailySummary.vi.ftl index 423121848..a370c7721 100644 --- a/src/main/resources/template/challengeDailySummary.vi.ftl +++ b/src/main/resources/template/challengeDailySummary.vi.ftl @@ -341,7 +341,7 @@
- Xem Tất Cả + Xem Tất Cả
From 94d6b54bd1b9cd44dec9e2c2ca791a721ac4f126 Mon Sep 17 00:00:00 2001 From: johnsonpham Date: Thu, 29 Oct 2015 14:16:54 +0700 Subject: [PATCH 19/34] add description for final app phase --- .../webapp/assets/modules/contest-detail/contestDetail.html | 4 +++- src/main/webapp/assets/modules/translation/messages_en.json | 1 + src/main/webapp/assets/modules/translation/messages_vi.json | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetail.html b/src/main/webapp/assets/modules/contest-detail/contestDetail.html index 2a33d143e..917f7fd3c 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetail.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetail.html @@ -278,7 +278,9 @@

+ ng-show="$index == selectedPhase && (phase.phase | progress: 'challengePhaseTitle' | lowercase) != 'winner' && (phase.phase | progress: 'challengePhaseTitle' | lowercase) != 'final app'">

+

diff --git a/src/main/webapp/assets/modules/translation/messages_en.json b/src/main/webapp/assets/modules/translation/messages_en.json index efff02993..9b20a7bf6 100644 --- a/src/main/webapp/assets/modules/translation/messages_en.json +++ b/src/main/webapp/assets/modules/translation/messages_en.json @@ -825,6 +825,7 @@ "reviewStatus": "Review Status", "winnerDes": "Select winner for each prize of the challenge:", "PhaseDes": "Select which contestants are qualified for the next round:", + "FinalDes": "Score your contestants to select winner(s) for the challenge:", "lastSubmissionDate": "Last Submission Date", "qualifiedNextPhase": "Qualified to next round?", "qualifyNextPhase": "Qualify to next round?", diff --git a/src/main/webapp/assets/modules/translation/messages_vi.json b/src/main/webapp/assets/modules/translation/messages_vi.json index 15b773f25..ab6197a6c 100644 --- a/src/main/webapp/assets/modules/translation/messages_vi.json +++ b/src/main/webapp/assets/modules/translation/messages_vi.json @@ -829,6 +829,7 @@ "reviewStatus": "Review Status", "winnerDes": "Lựa chọn người chiến thắng cho mỗi giải thưởng:", "PhaseDes": "Lựa chọn các thí sinh cho vòng tiếp theo:", + "FinalDes": "Chấm điểm thí sinh để lựa chọn người chiến thắng cho thử thách:", "lastSubmissionDate": "Ngày gửi bài gần nhất", "qualifiedNextPhase": "Đạt điều kiện vào vòng sau?", "qualifyNextPhase": "Đạt điều kiện vào vòng sau?", From 1162cf2616bb825a0410618546e23c6764b80c28 Mon Sep 17 00:00:00 2001 From: Phuong H Date: Thu, 29 Oct 2015 14:18:07 +0700 Subject: [PATCH 20/34] Fix auto add submission --- .../model/ChallengeSubmissionDto.java | 10 +++ .../common/challenge/submissionChallenge.js | 3 +- .../common/model/challengeRegistrant.js | 46 ++++++---- .../modules/contest-detail/contestDetail.html | 90 +------------------ .../contest-detail/contestDetailDirective.js | 7 +- .../contestDetailReviewSubmission.html | 6 +- 6 files changed, 48 insertions(+), 114 deletions(-) diff --git a/src/main/java/com/techlooper/model/ChallengeSubmissionDto.java b/src/main/java/com/techlooper/model/ChallengeSubmissionDto.java index 874d35ef0..f8d058371 100644 --- a/src/main/java/com/techlooper/model/ChallengeSubmissionDto.java +++ b/src/main/java/com/techlooper/model/ChallengeSubmissionDto.java @@ -25,6 +25,16 @@ public class ChallengeSubmissionDto implements Serializable { private String submissionDateTime; + private ChallengePhaseEnum submissionPhase; + + public ChallengePhaseEnum getSubmissionPhase() { + return submissionPhase; + } + + public void setSubmissionPhase(ChallengePhaseEnum submissionPhase) { + this.submissionPhase = submissionPhase; + } + public Long getChallengeSubmissionId() { return challengeSubmissionId; } diff --git a/src/main/webapp/assets/modules/common/challenge/submissionChallenge.js b/src/main/webapp/assets/modules/common/challenge/submissionChallenge.js index 9222284f7..6d15732ea 100644 --- a/src/main/webapp/assets/modules/common/challenge/submissionChallenge.js +++ b/src/main/webapp/assets/modules/common/challenge/submissionChallenge.js @@ -1,4 +1,4 @@ -techlooper.directive("submissionChallenge", function (localStorageService, apiService, $timeout, $rootScope, $translate) { +techlooper.directive("submissionChallenge", function (localStorageService, apiService, $timeout, $rootScope, $location) { return { restrict: "E", replace: true, @@ -70,6 +70,7 @@ techlooper.directive("submissionChallenge", function (localStorageService, apiSe return false; } $('.feedback-loading').css('visibility', 'inherit'); + $location.search({}); apiService.getUrlResponseCode(scope.submission.submissionURL) .success(function (code) { var inValid = (code == 404); diff --git a/src/main/webapp/assets/modules/common/model/challengeRegistrant.js b/src/main/webapp/assets/modules/common/model/challengeRegistrant.js index 0399f8b9b..9b8df1f15 100644 --- a/src/main/webapp/assets/modules/common/model/challengeRegistrant.js +++ b/src/main/webapp/assets/modules/common/model/challengeRegistrant.js @@ -17,22 +17,6 @@ techlooper.filter("challengeRegistrant", function (apiService, $rootScope, jsonV }); } - //if (challengePhase == registrant.activePhase) { - // registrant.qualifiedCurrentPhase = !registrant.disqualified; - //} - //else { - // registrant.qualifiedCurrentPhase = true; - //} - registrant.activePhase = registrant.activePhase ? registrant.activePhase : jsonValue.challengePhase.getRegistration().enum; - if (challengePhase != registrant.activePhase) { - registrant.qualified = true; - } - else { - if (registrant.disqualified == true) { - registrant.qualified = false; - } - } - registrant.criteriaLoop = function () { var criteria = registrant.criteria; if (!criteria) return []; @@ -89,12 +73,38 @@ techlooper.filter("challengeRegistrant", function (apiService, $rootScope, jsonV return parseFloat(sum) + parseFloat(calculatePoint(cri)); }, 0)).format("0.0"); - registrant.getLastSubmission = function () { + registrant.recalculate = function (challengePhase) { if (registrant.submissions) { - return _.max(registrant.submissions, function (submission) {return submission.challengeSubmissionId;}); + registrant.lastSubmission = _.max(registrant.submissions, function (submission) {return submission.challengeSubmissionId;}); + registrant.phaseSubmissions = _.filter(registrant.submissions, function (submission) {return submission.submissionPhase == challengePhase;}); + } + + registrant.activePhase = registrant.activePhase ? registrant.activePhase : jsonValue.challengePhase.getRegistration().enum; + if (challengePhase != registrant.activePhase) { + registrant.qualified = true; + } + else if (registrant.disqualified == true) { + registrant.qualified = false; } + } + registrant.acceptSubmission = function(submission) { + if (!_.findWhere(registrant.submissions, submission)) { + registrant.submissions.unshift(submission); + registrant.recalculate(submission.submissionPhase); + } + } + + registrant.recalculate(challengePhase); + + + + + //registrant. = function() { + // + //} + //registrant.qualifyMe = function(challengeDetail) { // delete registrant.disqualified; // delete registrant.disqualifiedReason; diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetail.html b/src/main/webapp/assets/modules/contest-detail/contestDetail.html index ce7f9c440..98e727111 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetail.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetail.html @@ -349,11 +349,11 @@

- {{user.getLastSubmission().submissionDateTime}} + {{user.lastSubmission.submissionDateTime}}
@@ -390,92 +390,6 @@

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailDirective.js b/src/main/webapp/assets/modules/contest-detail/contestDetailDirective.js index 31083bbb9..66b7af238 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailDirective.js +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailDirective.js @@ -52,9 +52,9 @@ techlooper delete scope.registrant.disqualifiedReason; scope.registrant.activePhase = scope.challenge.nextPhase; apiService.saveChallengeRegistrant(scope.registrant) - .success(function() { + .success(function () { apiService.acceptChallengeRegistrant(scope.registrant.registrantId) - .success(function(registrant) { + .success(function (registrant) { $rootScope.$broadcast("update-funnel", registrant); }); }); @@ -101,8 +101,7 @@ techlooper scope.$on("success-submission-challenge", function (sc, submission) { if (scope.registrant.registrantId != submission.registrantId) return; - scope.registrant.submissions.unshift(submission); - console.log(scope.registrant.submissions); + scope.registrant.acceptSubmission(submission); }); utils.sortByNumber(scope.registrant.submissions, "challengeSubmissionId"); diff --git a/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html b/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html index ad1473cf5..dbf0240df 100644 --- a/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html +++ b/src/main/webapp/assets/modules/contest-detail/contestDetailReviewSubmission.html @@ -1,16 +1,16 @@
-

- Xem Tất Cả Bài Gửi + Review All Submissions
diff --git a/src/main/resources/template/challengeDailySummary.vi.ftl b/src/main/resources/template/challengeDailySummary.vi.ftl index a370c7721..5dcc4a46e 100644 --- a/src/main/resources/template/challengeDailySummary.vi.ftl +++ b/src/main/resources/template/challengeDailySummary.vi.ftl @@ -341,7 +341,7 @@
- Xem Tất Cả + Xem Tất Cả Bài Gửi