Skip to content

Commit

Permalink
Merge pull request #105 from Balcan/master
Browse files Browse the repository at this point in the history
v1.0.5
  • Loading branch information
Balcan authored Dec 4, 2018
2 parents 4b969dc + 64d6802 commit 22b67dd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ private static RuleAction create(@NonNull Cursor cursor) {
return RuleActionHideSection.create(section);
case ASSIGN:
return RuleActionAssign.create(content, data,
isEmpty(attribute) ? dataElement : attribute, !isEmpty(attribute));
isEmpty(attribute) ? dataElement : attribute);
case SHOWWARNING:
return RuleActionShowWarning.create(content, data,
isEmpty(attribute) ? dataElement : attribute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void onAttach(@NonNull DataEntryView dataEntryView) {
);
}

private void save(String uid, String value, Boolean isAttribute) {
private void save(String uid, String value) {
CompositeDisposable saveDisposable = new CompositeDisposable();
saveDisposable.add(
dataEntryStore.save(uid, value)
Expand Down Expand Up @@ -214,12 +214,12 @@ private void applyRuleEffects(Map<String, FieldViewModel> fieldViewModels, Resul
RuleActionAssign assign = (RuleActionAssign) ruleAction;

if (fieldViewModels.get(assign.field()) == null)
save(assign.field(), ruleEffect.data(),assign.isAttribute());
save(assign.field(), ruleEffect.data());
else {
String value = fieldViewModels.get(assign.field()).value();

if (value == null || !value.equals(ruleEffect.data())) {
save(assign.field(), ruleEffect.data(),assign.isAttribute());
save(assign.field(), ruleEffect.data());
}

fieldViewModels.put(assign.field(), fieldViewModels.get(assign.field()).withValue(ruleEffect.data()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ final class ProgramStageRepository implements DataEntryRepository {
private static final String SECTION_RENDERING_TYPE = "SELECT ProgramStageSection.mobileRenderType FROM ProgramStageSection WHERE ProgramStageSection.uid = ?";
private static final String ACCESS_QUERY = "SELECT ProgramStage.accessDataWrite FROM ProgramStage JOIN Event ON Event.programStage = ProgramStage.uid WHERE Event.uid = ?";
private static final String PROGRAM_ACCESS_QUERY = "SELECT Program.accessDataWrite FROM Program JOIN Event ON Event.program = Program.uid WHERE Event.uid = ?";
private static final String OPTIONS = "SELECT Option.uid, Option.displayName FROM Option WHERE Option.optionSet = ?";
private static final String OPTIONS = "SELECT Option.uid, Option.displayName, Option.code FROM Option WHERE Option.optionSet = ?";

@NonNull
private final BriteDatabase briteDatabase;
Expand Down Expand Up @@ -150,9 +150,10 @@ private List<FieldViewModel> checkRenderType(List<FieldViewModel> fieldViewModel
for (int i = 0; i < cursor.getCount(); i++) {
String uid = cursor.getString(0);
String displayName = cursor.getString(1);
String code = cursor.getString(2);
renderList.add(fieldFactory.create(
fieldViewModel.uid() + "." + uid, //fist
displayName, ValueType.TEXT, false,
displayName+"-"+code, ValueType.TEXT, false,
fieldViewModel.optionSet(), fieldViewModel.value(), fieldViewModel.programStageSection(),
fieldViewModel.allowFutureDate(), fieldViewModel.editable() == null ? false : fieldViewModel.editable(), renderingType, fieldViewModel.description()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ public ImageHolder(FormImageBinding mBinding, FlowableProcessor<RowAction> proce
itemView.setOnClickListener(v -> {

if (isEditable) {
String value = null;
String value;
String[] uids = model.uid().split("\\.");
value = model.label();
String[] labelAndCode = model.label().split("-");
String label = labelAndCode[0];
String code = labelAndCode[1];

value =code;
valuePendingUpdate = value;
binding.frame.setVisibility(binding.frame.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
if(binding.frame.getVisibility()==View.VISIBLE) {
Expand All @@ -75,13 +79,16 @@ public void update(ImageViewModel viewModel) {

this.isEditable = viewModel.editable();
descriptionText = viewModel.description();
label = new StringBuilder(viewModel.label());
String[] labelAndCode = model.label().split("-");
String labelName = labelAndCode[0];
String code = labelAndCode[1];
label = new StringBuilder(labelName);
if (viewModel.mandatory())
label.append("*");
binding.setLabel(label.toString());
String[] uids = viewModel.uid().split("\\.");
Bindings.setObjectStyle(binding.icon, itemView, uids[1]);
if (viewModel.value() != null && viewModel.value().equals(viewModel.label()))
if (viewModel.value() != null && viewModel.value().equals(code))
binding.frame.setVisibility(View.VISIBLE);
else
binding.frame.setVisibility(View.GONE);
Expand Down
4 changes: 2 additions & 2 deletions buildsystem/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ ext {
sdk : 28,
tools : "28.0.3",
minSdk: 19,
vCode: 35,
vName: "1.0.4"
vCode: 36,
vName: "1.0.5"
]

libraries = [
Expand Down

0 comments on commit 22b67dd

Please sign in to comment.