Merge pull request #2681 from FinnStutzenstein/Issue2671

fixing duration in topic import (fixes #2671)
This commit is contained in:
Norman Jäckel 2016-11-24 00:03:52 +01:00 committed by GitHub
commit d9236c1920
2 changed files with 17 additions and 2 deletions

View File

@ -328,7 +328,22 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics'])
} }
// duration // duration
if (item.duration) { if (item.duration) {
item.duration = item.duration.replace(quotionRe, '$1'); var time = item.duration.replace(quotionRe, '$1').split(':'),
len = time.length,
data = '';
if (len > 1 && !isNaN(time[len-2]) && !isNaN(time[len-1])) { // minutes and hours
// e.g.: [sl:1000:]10:34 (the [] will not be parsed)
data = (+time[len-2]) * 60 + (+time[len-1]);
} else if (len == 1) { // just interpret minutes
data = (+time[0]);
} else {
data = null;
}
if (data < 0 || data === '') {
data = null; // no negative duration
}
item.duration = data;
} else { } else {
item.duration = null; item.duration = null;
} }

View File

@ -104,7 +104,7 @@
</span> </span>
{{ item.title }} {{ item.title }}
<td>{{ item.text | limitTo:80 }}{{ item.text.length > 80 ? '...' : '' }} <td>{{ item.text | limitTo:80 }}{{ item.text.length > 80 ? '...' : '' }}
<td>{{ item.duration }} <td>{{ item.duration | osMinutesToTime }}
<td>{{ item.comment }} <td>{{ item.comment }}
<td>{{ item.is_hidden }} <td>{{ item.is_hidden }}
</table> </table>