This is an automated email from the git hooks/post-receive script. New commit to branch hotfix/3.0.2 in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit c04bb083026ac59f52b05a0446f22af00723394c Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Oct 18 15:45:00 2017 +0200 correction de l'import CSV d'une liste de votants ( ref #159) + correction du chargement de la page --- .../service/FavoriteListImportFromFile.java | 26 +++++++------- .../web/tag/favoriteList/FavoriteList.tag.html | 40 +++++++++------------- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListImportFromFile.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListImportFromFile.java index d66e021c..da15eb15 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListImportFromFile.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/FavoriteListImportFromFile.java @@ -107,18 +107,20 @@ public class FavoriteListImportFromFile extends PollenServiceSupport implements if (!StringUtils.isBlank(line) && !line.startsWith("#")) { String[] columns = line.split(";"); - String email = getCleanMail(columns[0]) ; - String memberName = columns.length >= 2 ? columns[1] : email; - double weight = columns.length >= 3 ? Double.parseDouble(columns[2]) : 1; - - FavoriteListMember member = getFavoriteListMemberDao().create(); - member.setName(memberName); - member.setEmail(email); - member.setWeight(weight); - member.setFavoriteList(favoriteList); - - if (log.isDebugEnabled()) { - log.debug(String.format("imported member %s / %s", memberName, email)); + if (columns.length > 0) { + String email = getCleanMail(columns[0]); + String memberName = columns.length >= 2 ? columns[1] : email; + double weight = columns.length >= 3 ? Double.parseDouble(columns[2]) : 1; + + FavoriteListMember member = getFavoriteListMemberDao().create(); + member.setName(memberName); + member.setEmail(email); + member.setWeight(weight); + member.setFavoriteList(favoriteList); + + if (log.isDebugEnabled()) { + log.debug(String.format("imported member %s / %s", memberName, email)); + } } } } diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html index ceac20ac..7a3081c5 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html @@ -8,12 +8,12 @@ it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. #L% @@ -40,7 +40,7 @@ require("../components/LoadingCard.tag.html"); <div class="main-content"> <div class="c-alert c-alert--info"> - {getCountLabel()} + {countLabel} </div> <Search onsearch={refresh} search={search} if={favoriteList.countChildren + favoriteList.countMembers > 1}/> @@ -107,11 +107,10 @@ require("../components/LoadingCard.tag.html"); }; this.children = []; - this.getCountLabel = () => { + this.updateCountLabel = () => { let label; - if (this.favoriteList.countChildren === 0 && this.favoriteList.countMembers == 0) { + if (this.favoriteList.countChildren === 0 && this.favoriteList.countMembers === 0) { label = this._l("noMember"); - } else { let childrenLabel = ""; if (this.favoriteList.countChildren > 0) { @@ -121,9 +120,9 @@ require("../components/LoadingCard.tag.html"); childrenLabel = this._l("children", this.favoriteList.countChildren); } if (this.favoriteList.filteredCountChildren - && this.favoriteList.filteredCountChildren != this.favoriteList.countChildren + && this.favoriteList.filteredCountChildren !== this.favoriteList.countChildren || this.favoriteList.filteredCountMembers - && this.favoriteList.filteredCountMembers != this.favoriteList.countMembers) { + && this.favoriteList.filteredCountMembers !== this.favoriteList.countMembers) { if (this.favoriteList.filteredCountChildren === 0) { childrenLabel = this._l("noFound") + childrenLabel; } else if (this.favoriteList.filteredCountChildren === 1) { @@ -143,9 +142,9 @@ require("../components/LoadingCard.tag.html"); membersLabel = this._l("members", this.favoriteList.countMembers); } if (this.favoriteList.filteredCountChildren - && this.favoriteList.filteredCountChildren != this.favoriteList.countChildren + && this.favoriteList.filteredCountChildren !== this.favoriteList.countChildren || this.favoriteList.filteredCountMembers - && this.favoriteList.filteredCountMembers != this.favoriteList.countMembers) { + && this.favoriteList.filteredCountMembers !== this.favoriteList.countMembers) { if (this.favoriteList.filteredCountMembers === 0) { membersLabel = this._l("noFound") + membersLabel; } else if (this.favoriteList.filteredCountMembers === 1) { @@ -157,26 +156,22 @@ require("../components/LoadingCard.tag.html"); } label = childrenLabel + membersLabel; } - return label; - } + this.countLabel = label; + }; this.reloadFavoriteListInfos = () => { favoriteListService.favoriteList(this.favoriteList.id).then(results => { this.favoriteList = results; + this.updateCountLabel(); this.loaded = true; - console.log("reloadFavoriteListInfos"); - console.log(results); this.update(); }); }; - this.reloadFavoriteListInfos(); this.search = {value: ""}; this.addMember = () => { this.refs.createMemberModal.open().then(() => { - this.update(); - this.reloadFavoriteListInfos(); this.refresh(); }, () => {}); this.update(); @@ -184,8 +179,6 @@ require("../components/LoadingCard.tag.html"); this.importCsv = () => { this.refs.importCsvModal.open().then(() => { - this.update(); - this.reloadFavoriteListInfos(); this.refresh(); }, () => {}); this.update(); @@ -193,8 +186,6 @@ require("../components/LoadingCard.tag.html"); this.importLdap = () => { this.refs.importLdapModal.open().then(() => { - this.update(); - this.reloadFavoriteListInfos(); this.refresh(); }, () => {}); this.update(); @@ -202,26 +193,27 @@ require("../components/LoadingCard.tag.html"); this.createChildList = () => { this.refs.createChildListModal.open().then(() => { - this.update(); - this.reloadFavoriteListInfos(); this.refresh(); }, () => {}); this.update(); }; this.refresh = () => { + this.reloadFavoriteListInfos(); this.refs.lazyLoad.reload(); }; this.lazyLoad = pagination => { return favoriteListService.allChildren(this.favoriteList.id, pagination, this.search.value).then(results => { - let length = results.elements.length; + let length = results.pagination.count; this.favoriteList.filteredCountChildren = results.elements.filter(element => element.child).length; this.favoriteList.filteredCountMembers = length - this.favoriteList.filteredCountChildren; + this.updateCountLabel(); this.update(); return results; }); }; + this.reloadFavoriteListInfos(); </script> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.