Changeset 199 for trunk/grails-app/domain
- Timestamp:
- Nov 28, 2009, 2:17:34 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 stacktrace.log1 *.log 2 2 *.war
-
- Property svn:ignore
-
trunk/grails-app/domain/Period.groovy
r136 r199 3 3 String period 4 4 boolean isActive = true 5 6 static hasMany = [taskRecurringSchedules: TaskRecurringSchedule]7 8 static mappedBy = [taskRecurringSchedules:"recurPeriod"]9 5 10 6 // static belongsTo = [] -
trunk/grails-app/domain/TaskRecurringSchedule.groovy
r195 r199 5 5 Task lastGeneratedSubTask 6 6 Period recurPeriod 7 Period generateAheadPeriod8 7 Period taskDurationPeriod 9 8 … … 11 10 Integer taskDuration = 0 12 11 Integer generateAhead = 1 13 Date startDate = new Date()14 Date lastGeneratedDate12 Integer subTasksGenerated = 0 13 Date nextGenerationDate = new Date() 15 14 Date nextTargetStartDate = new Date() 16 15 Date nextTargetCompletionDate = new Date() 17 Date nextGenerationDate = new Date() 18 boolean isEnabled = true 16 boolean enabled = true 19 17 20 18 // static hasMany = [] … … 25 23 recurEvery(min:1, max:365) 26 24 taskDuration(min:0, max:365) 27 generateAhead(min:0, max:365) 28 lastGeneratedDate(nullable:true) 25 generateAhead(min:0, max:62) 29 26 lastGeneratedSubTask(nullable:true) 30 27 } … … 38 35 // in the hope that this will be fixed in future versions. 39 36 def beforeInsert = { 40 nextTargetStartDate = startDate41 37 setNextGenerationDate() 42 38 setNextTargetCompletionDate() 43 39 } 44 40 45 public void setNext GenerationDate() {46 switch ( generateAheadPeriod.period) {41 public void setNextTargetStartDate() { 42 switch (recurPeriod.period) { 47 43 case "Day(s)": 48 44 use(TimeCategory) { 49 next GenerationDate = nextTargetStartDate - generateAhead.days45 nextTargetStartDate = nextTargetStartDate + recurEvery.days 50 46 } 51 47 break 52 48 case "Week(s)": 53 49 use(TimeCategory) { 54 next GenerationDate = nextTargetStartDate - generateAhead.weeks50 nextTargetStartDate = nextTargetStartDate + recurEvery.weeks 55 51 } 56 52 break 57 53 case "Month(s)": 58 54 use(TimeCategory) { 59 next GenerationDate = nextTargetStartDate - generateAhead.months55 nextTargetStartDate = nextTargetStartDate + recurEvery.months 60 56 } 61 57 break 62 58 case "Year(s)": 63 59 use(TimeCategory) { 64 next GenerationDate = nextTargetStartDate - generateAhead.years60 nextTargetStartDate = nextTargetStartDate + recurEvery.years 65 61 } 66 62 break 67 63 default: 64 log.error "No case for recurPeriod.period: ${recurPeriod.period}" 68 65 break 66 } 67 } 68 69 public void setNextGenerationDate() { 70 use(TimeCategory) { 71 nextGenerationDate = nextTargetStartDate - generateAhead.days 69 72 } 70 73 def now = new Date() … … 95 98 break 96 99 default: 100 log.error "No case for taskDurationPeriod.period: ${taskDurationPeriod.period}" 97 101 break 98 102 }
Note: See TracChangeset
for help on using the changeset viewer.