Small style changes.

This commit is contained in:
Norman Jäckel 2016-09-22 21:43:49 +02:00 committed by Norman Jäckel
parent 970f42cacb
commit 926516ac65
3 changed files with 7 additions and 9 deletions

View File

@ -9,7 +9,6 @@ def convert_duration(apps, schema_editor):
Item = apps.get_model('agenda', 'item') Item = apps.get_model('agenda', 'item')
for item in Item.objects.all(): for item in Item.objects.all():
duration = item.duration duration = item.duration
item.duration_tmp = None item.duration_tmp = None
if is_int(duration): if is_int(duration):
# assuming that these are minutes # assuming that these are minutes
@ -26,9 +25,10 @@ def convert_duration(apps, schema_editor):
def is_int(s): def is_int(s):
try: try:
int(s) int(s)
return True
except ValueError: except ValueError:
return False return False
else:
return True
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -129,7 +129,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
if (startTime) { if (startTime) {
var timestamp = Date.parse(startTime) + totalDuration * 60 * 1000; var timestamp = Date.parse(startTime) + totalDuration * 60 * 1000;
var endDate = new Date(timestamp); var endDate = new Date(timestamp);
var mm = ("0"+endDate.getMinutes()).slice(-2); var mm = ("0" + endDate.getMinutes()).slice(-2);
var dateStr = endDate.getHours() + ':' + mm; var dateStr = endDate.getHours() + ':' + mm;
return dateStr; return dateStr;
} else { } else {

View File

@ -433,10 +433,8 @@ angular.module('OpenSlidesApp.core', [
.filter('osMinutesToTime', [ .filter('osMinutesToTime', [
function () { function () {
return function (totalminutes) { return function (totalminutes) {
if (!totalminutes) { var time = '';
return ''; if (totalminutes) {
} else {
var time = "";
if (totalminutes < 0) { if (totalminutes < 0) {
time = "-"; time = "-";
totalminutes = -totalminutes; totalminutes = -totalminutes;
@ -444,10 +442,10 @@ angular.module('OpenSlidesApp.core', [
var hh = Math.floor(totalminutes / 60); var hh = Math.floor(totalminutes / 60);
var mm = Math.floor(totalminutes % 60); var mm = Math.floor(totalminutes % 60);
// Add leading "0" for double digit values // Add leading "0" for double digit values
mm = ("0"+mm).slice(-2); mm = ("0" + mm).slice(-2);
time += hh + ":" + mm; time += hh + ":" + mm;
return time;
} }
return time;
}; };
} }
]) ])