Ignore:
Timestamp:
Nov 19, 2009, 1:47:55 PM (15 years ago)
Author:
gav
Message:

Switch creatDemoEntries to use the taskService.createEntry service.
Switch some findByName's to get(id).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/services/CreateDataService.groovy

    r185 r190  
    560560        def entryTypeInstance
    561561
    562         entryTypeInstance = new EntryType(name:"Fault")
     562        entryTypeInstance = new EntryType(name:"Fault") // #1
    563563        saveAndTest(entryTypeInstance)
    564564
    565         entryTypeInstance = new EntryType(name:"WorkDone")
     565        entryTypeInstance = new EntryType(name:"Work Done") // #2
    566566        saveAndTest(entryTypeInstance)
    567567
    568         entryTypeInstance = new EntryType(name:"Production Note")
     568        entryTypeInstance = new EntryType(name:"Production Note") // #3
    569569        saveAndTest(entryTypeInstance)
    570570
    571         entryTypeInstance = new EntryType(name:"Work Request")
     571        entryTypeInstance = new EntryType(name:"Work Request") // #4
    572572        saveAndTest(entryTypeInstance)
    573573    }
     
    575575    def createDemoEntries() {
    576576
    577         //Entry
    578         def entryInstance
     577        def entryResult
     578        def p = [:]
    579579
    580580        //Entry #1
    581         entryInstance = new Entry(enteredBy: Person.get(3),
    582                                                     task: Task.get(1),
    583                                                     entryType: EntryType.findByName("Fault"),
    584                                                     comment: "This level sensor is causing us trouble.",
    585                                                     durationMinute: 20)
    586         saveAndTest(entryInstance)
     581        p = [task: Task.get(1),
     582                entryType: EntryType.get(1),
     583                comment: "This level sensor is causing us trouble.",
     584                durationMinute: 20]
     585
     586        entryResult = taskService.createEntry(p)
    587587
    588588        //Entry #2
    589         entryInstance = new Entry(enteredBy: Person.get(4),
    590                                                     task: Task.get(1),
    591                                                     entryType: EntryType.findByName("WorkDone"),
    592                                                     comment: "Cleaned sensor, see how it goes.",
    593                                                     durationMinute: 30)
    594         saveAndTest(entryInstance)
     589        p = [task: Task.get(1),
     590                entryType: EntryType.get(2),
     591                comment: "Cleaned sensor, see how it goes.",
     592                durationMinute: 30]
     593
     594        entryResult = taskService.createEntry(p)
    595595
    596596        //Entry #3
    597         entryInstance = new Entry(enteredBy: Person.get(4),
    598                                                     task: Task.get(1),
    599                                                     entryType: EntryType.findByName("WorkDone"),
    600                                                     comment: "Checked up on it later and sensor is dropping out intermittently, created subTask to replace sensor.",
    601                                                     durationMinute: 20)
    602         saveAndTest(entryInstance)
     597        p = [task: Task.get(1),
     598                entryType: EntryType.get(2),
     599                comment: "Checked up on it later and sensor is dropping out intermittently, created sub task to replace sensor.",
     600                durationMinute: 20]
     601
     602        entryResult = taskService.createEntry(p)
    603603    }
    604604
Note: See TracChangeset for help on using the changeset viewer.