Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix11k #38

Closed
wants to merge 14 commits into from
Closed

Fix11k #38

wants to merge 14 commits into from

Conversation

sheetalk
Copy link
Contributor

No description provided.

@hrjet
Copy link

hrjet commented Apr 28, 2014

Can one of the admins verify this patch?

@hrj
Copy link
Owner

hrj commented Apr 28, 2014

ok to test

@hrj
Copy link
Owner

hrj commented Apr 28, 2014

add sheetalk to whitelist


def makeClosureSettings(config: Config) = {
val source = config.getStringList("source").asScala
val destination = config.getStringList("destination").asScala
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

destination will be always one. Hence it should not be a list.

This was referenced Apr 28, 2014
@@ -180,10 +197,18 @@ abstract class ReportSettings(val title: String, val accountMatch: Option[Seq[St
abstract class ExportSettings(val accountMatch: Option[Seq[String]], val outFiles: Seq[String]) extends AccountMatcher {
}

abstract class ClosureExportSettings1(val source: Seq[String], val destination: String) extends closureMatcher {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why you need this abstract class. If not required, plz remove it.

@hrj
Copy link
Owner

hrj commented Apr 28, 2014

Important: You need to check for an error condition: If the same account is present in more than one closure source, then it is an error.

For example,

closures += {
  sources = "Income"
  destination = "xyz"
}

closures += {
  sources = "Income"
  destination = "xyz"
}

should throw an error, because Income will be matched twice!

@hrj
Copy link
Owner

hrj commented Apr 29, 2014

retest this please

val destClosureSort = destClosure.toSeq.sortBy(_.accountName.toString)
srcClosureSort ++: destClosureSort
}
val closure = LedgerExportData(latestDate, closureEntries.head)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are calling closureEntries.head, which will only export the first closure.
What about the remaining closures?

@sheetalk
Copy link
Contributor Author

sheetalk commented May 1, 2014

Sir,Can you tell me,Which comment I have not solved ???
According to me,I am Done.

@hrj
Copy link
Owner

hrj commented May 1, 2014

This one I have not solved.As 'config' is not returning list of 'closures'.

You can solve it by writing a unit test case for it. In the test cases we are not using the config library.

@sheetalk
Copy link
Contributor Author

sheetalk commented May 1, 2014

"

Important: You need to check for an error condition: If the same account is present in more than one closure source, then it is an error.

For example,

closures += {
sources = "Income"
destination = "xyz"
}

closures += {
sources = "Income"
destination = "xyz"
}

should throw an error, because Income will be matched twice!

"This one I have not solved.As 'config' is not returning list of 'closures'.

@sheetalk
Copy link
Contributor Author

sheetalk commented May 1, 2014

Sir,
I have added unit test case.It is throwing exception if 'source' in closure contains duplicate 'accountName'.

@hrj
Copy link
Owner

hrj commented May 1, 2014

good, now you have to modify the testcase to handle the exception.

See this tip: http://alvinalexander.com/scala/scalatest-testing-expected-exceptions-intercept-testfailedexception

@sheetalk
Copy link
Contributor Author

sheetalk commented May 1, 2014

Done

@hrj hrj closed this May 1, 2014
@hrj hrj reopened this May 1, 2014
if (sourceNames.contains(srcEntry._1)) {
throw new Exception("Duplicate Source Names")
} else {
sourceNames = sourceNames :+ srcEntry._1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are modifying a var inside a map application. Remember map should not have side-effects.

I suggest you separate out the check for sourceNames into a separate function and use foreach whenever you need a side-effect.

@sheetalk
Copy link
Contributor Author

sheetalk commented May 1, 2014

Sir,
I have separated sourceNames into a separate function
Please check

@hrj
Copy link
Owner

hrj commented May 2, 2014

I have separated sourceNames into a separate function

Thanks for the effort. The way you have defined the new function is not ideal. But explaining over email is difficult. I will make some changes directly, squash the commits and push directly to master.

@sheetalk
Copy link
Contributor Author

sheetalk commented May 2, 2014

k sir

@hrj
Copy link
Owner

hrj commented May 2, 2014

Superceded by #39

@hrj hrj closed this May 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants