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:
parent
f3a049777a
commit
652cc8703a
@ -1,5 +1,6 @@
|
|||||||
<project name="Time Analyzer" default="compile">
|
<project name="Time Analyzer" default="compile">
|
||||||
|
|
||||||
|
<property file="project.properties"/>
|
||||||
<import file="jdb-build-1.5.xml"/>
|
<import file="jdb-build-1.5.xml"/>
|
||||||
|
|
||||||
<target name="init"/>
|
<target name="init"/>
|
||||||
|
Binary file not shown.
@ -1,3 +1,4 @@
|
|||||||
#Fri, 14 Jan 2011 22:05:22 -0600
|
#Sat, 22 Jan 2011 19:30:42 -0600
|
||||||
|
name=time-analyzer
|
||||||
build.number=1
|
version=0.1
|
||||||
|
build.number=4
|
||||||
|
@ -3,7 +3,9 @@ package com.jdbernard.timeanalyzer
|
|||||||
public class DescriptionBasedCategorizationPlan implements CategorizationPlan {
|
public class DescriptionBasedCategorizationPlan implements CategorizationPlan {
|
||||||
|
|
||||||
public boolean deservesNewCategory(Event event, List<Event> existingEvents) {
|
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,
|
public Category newCategory(Event event,
|
||||||
@ -13,7 +15,9 @@ public class DescriptionBasedCategorizationPlan implements CategorizationPlan {
|
|||||||
|
|
||||||
public List<Event> findEventsToRecategorize(Event event,
|
public List<Event> findEventsToRecategorize(Event event,
|
||||||
List<Event> existingEvents) {
|
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) {
|
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) {
|
public Event addEvent(Event e) {
|
||||||
TicketEvent te = new TicketEvent(e)
|
TicketEvent te = new TicketEvent(e)
|
||||||
events << te
|
events << te
|
||||||
|
return te
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,24 +33,24 @@ ithelpcat.categorizationPlans << descriptionBasedCatPlan
|
|||||||
|
|
||||||
topcat.categories << ithelpcat
|
topcat.categories << ithelpcat
|
||||||
|
|
||||||
//events.each { if (topcat.matchesEvent(it)) topcat.addEvent(it) }
|
events.each { if (topcat.matchesEvent(it)) topcat.addEvent(it) }
|
||||||
|
|
||||||
makePieDataset = { category ->
|
makePieDataset = { category ->
|
||||||
DefaultPieDataset dpds = new DefaultPieDataset()
|
DefaultPieDataset dpds = new DefaultPieDataset()
|
||||||
category.categories.each { cat ->
|
category.categories.each { cat ->
|
||||||
dpds.setValue(cat.description, cat.duration.standardSeconds) }
|
dpds.setValue(cat.description, cat.duration.standardSeconds) }
|
||||||
category.entries.each { entry ->
|
category.events.each { entry ->
|
||||||
dpds.setValue(entry.description, entry.duration.standardSeconds) }
|
dpds.setValue(entry.description, entry.duration.standardSeconds) }
|
||||||
dpds.sortByValues(SortOrder.DESCENDING)
|
dpds.sortByValues(SortOrder.DESCENDING)
|
||||||
|
|
||||||
return dpds
|
return dpds
|
||||||
}
|
}
|
||||||
|
|
||||||
//topcatDataset = makePieDataset(topcat)
|
topcatDataset = makePieDataset(topcat)
|
||||||
//ithelpDataset = makePieDataset(ithelpcat)
|
ithelpDataset = makePieDataset(ithelpcat)
|
||||||
|
|
||||||
//topcatFrame = new ChartFrame("Top Category",
|
topcatFrame = new ChartFrame("Top Category",
|
||||||
//ChartFactory.createPieChart("Time Spent", topcatDataset, true, true, false))
|
ChartFactory.createPieChart("Time Spent", topcatDataset, true, true, false))
|
||||||
//ithelpFrame = new ChartFrame("ITHelp",
|
ithelpFrame = new ChartFrame("ITHelp",
|
||||||
//ChartFactory.createPieChart("Time Spent", ithelpDataset, true, true, false))
|
ChartFactory.createPieChart("Time Spent", ithelpDataset, true, true, false))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user