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

Add direct raw value access for calculated fields #44

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ $ ./gradlew gem # -t to watch change of files and rebuild continuously

## Development
```
$ ./gradew build
$ ./gradew test
$ ./gradlew build
$ ./gradlew test
```
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private String getAsString(final String fieldCode)
case NUMBER:
return toString(record.getNumberFieldValue(fieldCode), BigDecimal::toString);
case CALC:
return toString(record.getCalcFieldValue(fieldCode), BigDecimal::toString);
return record.getCalcFieldRawValue(fieldCode);
case CHECK_BOX:
return toString(record.getCheckBoxFieldValue(fieldCode));
case RADIO_BUTTON:
Expand Down
14 changes: 12 additions & 2 deletions src/test/java/org/embulk/input/kintone/TestKintoneAccessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ public Record createTestRecord()
testRecord.putField("作成日時", new CreatedTimeFieldValue(ZonedDateTime.parse("2012-01-11T11:30:00Z")));
testRecord.putField("更新者", new ModifierFieldValue(modifier));
testRecord.putField("更新日時", new UpdatedTimeFieldValue(ZonedDateTime.parse("2012-01-11T11:30:00Z")));
testRecord.putField("計算", new CalcFieldValue(new BigDecimal("1.23E-12")));
testRecord.putField("計算(Calc)", new CalcFieldValue("1.23E-12"));
testRecord.putField("数値(Calc)", new CalcFieldValue("1234"));
testRecord.putField("日時(Calc)", new CalcFieldValue("2012-01-11T11:30:00Z"));
testRecord.putField("日付(Calc)", new CalcFieldValue("2012-01-11"));
testRecord.putField("時刻(Calc)", new CalcFieldValue("11:30"));
testRecord.putField("時間(Calc)", new CalcFieldValue("49:30"));
FileBody body1 = new FileBody();
body1.setFileKey("sample_file1");
FileBody body2 = new FileBody();
Expand Down Expand Up @@ -153,7 +158,12 @@ public void testAccess()
assertEquals("2012-01-11T11:30:00Z", accessor.get("作成日時"));
assertEquals("code10", accessor.get("更新者"));
assertEquals("2012-01-11T11:30:00Z", accessor.get("更新日時"));
assertEquals("1.23E-12", accessor.get("計算"));
assertEquals("1.23E-12", accessor.get("計算(Calc)"));
assertEquals("1234", accessor.get("数値(Calc)"));
assertEquals("2012-01-11T11:30:00Z", accessor.get("日時(Calc)"));
assertEquals("2012-01-11", accessor.get("日付(Calc)"));
assertEquals("11:30", accessor.get("時刻(Calc)"));
assertEquals("49:30", accessor.get("時間(Calc)"));
assertEquals("sample_file1\nsample_file2", accessor.get("添付ファイル"));
assertEquals("sample_category1\nsample_category2", accessor.get("カテゴリー"));
assertEquals("sample_status", accessor.get("ステータス"));
Expand Down
Loading