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:
@ -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 }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,5 +20,6 @@ public class TicketCategory extends Category {
|
||||
public Event addEvent(Event e) {
|
||||
TicketEvent te = new TicketEvent(e)
|
||||
events << te
|
||||
return te
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user