Changes to Description categories, other fixes.

Description based category is now case-insensitive.
Fixed bug where description categories and plans were not agreeing on how
  to categories items.
Updated startscript.groovy to be aware of new changes with events.
Update build script properties.
This commit is contained in:
Jonathan Bernard
2011-01-22 19:31:36 -06:00
parent f3a049777a
commit 652cc8703a
7 changed files with 22 additions and 14 deletions

View File

@ -3,7 +3,9 @@ package com.jdbernard.timeanalyzer
public class DescriptionBasedCategorizationPlan implements CategorizationPlan {
public boolean deservesNewCategory(Event event, List<Event> existingEvents) {
return existingEvents.any { it.description == event.description }
def desc = event.description.replaceAll(/\p{Punct}/, '').toLowerCase()
return existingEvents.any {
it.description.replaceAll(/\p{Punct}/, '').toLowerCase() == desc }
}
public Category newCategory(Event event,
@ -13,7 +15,9 @@ public class DescriptionBasedCategorizationPlan implements CategorizationPlan {
public List<Event> findEventsToRecategorize(Event event,
List<Event> existingEvents) {
return existingEvents.findAll { it.description == event.description }
def desc = event.description.replaceAll(/\p{Punct}/, '').toLowerCase()
return existingEvents.findAll {
it.description.replaceAll(/\p{Punct}/, '').toLowerCase() == desc }
}
}

View File

@ -10,7 +10,8 @@ public class DescriptionBasedCategory extends Category {
}
public boolean matchesEvent(Event e) {
return e.description.replaceAll(/\p{Punct}/, '') == description
return e.description.replaceAll(/\p{Punct}/, '').toLowerCase() ==
description.toLowerCase()
}
}

View File

@ -20,5 +20,6 @@ public class TicketCategory extends Category {
public Event addEvent(Event e) {
TicketEvent te = new TicketEvent(e)
events << te
return te
}
}