Skip to content

Commit

Permalink
bugfix (eventdetails on second day were the ones from the first day)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertkowalski committed Aug 5, 2011
1 parent d015bb1 commit 443486f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
9 changes: 6 additions & 3 deletions source/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ enyo.kind({
this.getNetworkStatus();

this.dayData = [];
this.day = 0;
},
rendered: function() {
this.inherited(arguments);
Expand Down Expand Up @@ -178,7 +179,7 @@ enyo.kind({
this.$.rooms.createComponent({flex: 1, style:"width:320px; float:left;",
name: "dayList" + i, owner: this, kind: "VirtualRepeater", onSetupRow: "listSetupRow",
className: "list", components: [
{owner:this, name: "EventItem" + i, kind: "EventItem",
{owner: this, name: "EventItem" + i, kind: "EventItem",
className: "item", popup: "eventInfoPopup", day: 0, room: i,
onEntryClick: "showPopup", components: [
]}
Expand All @@ -199,6 +200,7 @@ enyo.kind({
},
buttonItemClick: function(inSender) {
this.humanDay = inSender.day + 1;
this.day = inSender.day;

for (var i = 0; i < this.buttonNames.length; i++) {
if (inSender.name != this.buttonNames[i]) {
Expand All @@ -215,7 +217,6 @@ enyo.kind({

html += "<div style='width: 320px; text-align:center; float: left;'>" + this.data.schedule.day[inSender.day].room[i].name + "</div>";


this.room = i;
this.dayData = this.data.schedule.day[inSender.day].room[i].event;
this.$["dayList" + i].render();
Expand All @@ -228,7 +229,7 @@ enyo.kind({
this.$.slidingPane.back(e);
},
listSetupRow: function(inSender, inIndex) {
//console.log(inSender.name)

try {
var record = this.dayData[inIndex];
} catch(e) {
Expand All @@ -237,6 +238,8 @@ enyo.kind({

if (record) {
this.$['EventItem' + this.room].setEntry(record);
this.$['EventItem' + this.room].day = this.day;

return true;
}
},
Expand Down
18 changes: 6 additions & 12 deletions source/ProcessFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,18 @@ enyo.kind({
calculateStartEnding: function (minutes) {
var minutes = Number(minutes);
if (minutes <= 240) {

return minutes + 1440
} else {

return minutes
}
},
minutesToHours: function (minutes) {
var minutes = Number(minutes);
var hours = minutes / 60;
console.log(hours);
},
calculateEndHuman: function (startTime, duration, date) {
var startTime = startTime.split(':');
//2011-08-13
var dayDate = date.split('-');
//new Date(jahr, monat-1, tag, stunde, minute

var dayDate = date.split('-'); //2011-08-13

var dateObj = new Date(Number(dayDate[0]), Number(dayDate[1]) - 1, Number(dayDate[2]), Number(startTime[0]), Number(startTime[1]));
var timeStamp = Number(dateObj.getTime());

Expand All @@ -78,11 +75,10 @@ enyo.kind({
} else {
resultminutes = resultObj.getMinutes();
}

return resultObj.getHours() + ":" + resultminutes
},

dataChanged: function() {

for (var day = 0; day < this.data.schedule.day.length; day++) {
var date = this.data.schedule.day[day].date;
for (var room = 0; room < this.data.schedule.day[day].room.length; room++) {
Expand All @@ -100,11 +96,9 @@ enyo.kind({
this.data.schedule.day[day].room[room][e][i].endMinutes = this.data.schedule.day[day].room[room].event[i].startMinutes + this.data.schedule.day[day].room[room].event[i].durationMinutes;
this.data.schedule.day[day].room[room][e][i].end = this.calculateEndHuman(this.data.schedule.day[day].room[room].event[i].start, this.data.schedule.day[day].room[room].event[i].durationMinutes, date);
this.data.schedule.day[day].room[room][e][i].empty = false;

}
}
}

if ("undefined" == typeof(this.data.schedule.day[day].room[room].event)) {
this.data.schedule.day[day].room[room].event = [];
this.data.schedule.day[day].room[room].event[0] = {};
Expand Down

0 comments on commit 443486f

Please sign in to comment.