OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 150 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 150 Rev 181
Line 115... Line 115...
115
        calendar.scrollTo(8);
115
        calendar.scrollTo(8);
116
        w.setPopupMenuProvider(new OperationMenuProvider());
116
        w.setPopupMenuProvider(new OperationMenuProvider());
117
        this.beginStateSaving(conf.getConfDir(), w);
117
        this.beginStateSaving(conf.getConfDir(), w);
118
    }
118
    }
119
 
119
 
120
    public static Map<Integer, Long> getDurations(List<List<JCalendarItem>> list, final Flag requiredFlag) {
120
    public static Map<Integer, Long> getDurations(List<List<JCalendarItem>> list, final Flag requiredFlag, final Flag excludedFlag) {
121
        final Map<Integer, Long> res = new HashMap<>();
121
        final Map<Integer, Long> res = new HashMap<>();
122
        final Flag freeTimeFlag = ModuleOperation.FREE_TIME_FLAG;
-
 
123
        for (List<JCalendarItem> items : list) {
122
        for (List<JCalendarItem> items : list) {
124
            for (JCalendarItem item : items) {
123
            for (JCalendarItem item : items) {
125
                if (!item.hasFlag(freeTimeFlag) && (requiredFlag == null || item.hasFlag(requiredFlag)) && item.getCookie() instanceof SQLRowValues) {
124
                if (!item.hasFlag(excludedFlag) && (requiredFlag == null || item.hasFlag(requiredFlag)) && item.getCookie() instanceof SQLRowValues) {
126
                    final SQLRowValues user = (SQLRowValues) item.getCookie();
125
                    final SQLRowValues user = (SQLRowValues) item.getCookie();
127
                    final long toAddMinutes = (item.getDtEnd().getTimeInMillis() - item.getDtStart().getTimeInMillis()) / (60 * 1000);
126
                    final long toAddMinutes = (item.getDtEnd().getTimeInMillis() - item.getDtStart().getTimeInMillis()) / (60 * 1000);
128
                    final Integer key = user.getID();
127
                    final Integer key = user.getID();
129
                    final Long currentVal = res.get(key);
128
                    final Long currentVal = res.get(key);
130
                    res.put(key, (currentVal == null ? 0 : currentVal.longValue()) + toAddMinutes);
129
                    res.put(key, (currentVal == null ? 0 : currentVal.longValue()) + toAddMinutes);