fixed post update tutortab

This commit is contained in:
Marcin Jedynski 2018-11-27 14:51:55 +01:00
parent c43aabf739
commit e96981c8b9
2 changed files with 18 additions and 4 deletions

View File

@ -60,6 +60,7 @@ public class TutorTab extends AppCompatActivity {
TextView userEmail = findViewById(R.id.userEmail);
TextView department = findViewById(R.id.userDepartment);
Button saveButon = findViewById(R.id.saveButon);
userName.setText(String.format("%s %s", PrefUtils.getUserFirstName(getApplicationContext()), PrefUtils.getUserLastName(getApplicationContext())));
disposable.add(
tutorTabService.apiUsersTutorTabByTutorIdGet(PrefUtils.getUserId(getApplicationContext()))
@ -68,7 +69,9 @@ public class TutorTab extends AppCompatActivity {
.subscribeWith(new DisposableSingleObserver<TutorTabViewModel>() {
@Override
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
newTab = tutorTabViewModel;
// newTab = tutorTabViewModel;
// Log.d("TUTORTAB onsuc toPost",newTab.toString());
List<String> dutyHoursList = Stream.of(tutorTabViewModel.getDutyHours())
.map(DutyHourViewModel::getSummary).toList();
Log.d("TUTORTAB", Arrays.toString(dutyHoursList.toArray()));
@ -111,9 +114,12 @@ public class TutorTab extends AppCompatActivity {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
TutorTabViewModel toPost = newTab;
toPost.setNote(note.getText().toString());
putUserTab(toPost);
newTab = new TutorTabViewModel(PrefUtils.getUserId(getApplicationContext()),note.getText().toString());
Log.d("TUTORTAB button",note.getText().toString());
Log.d("TUTORTAB toPost",newTab.toString());
//topost jest nullem
// toPost.setNote(note.getText().toString());
putUserTab(newTab);
}
});
}

View File

@ -33,11 +33,19 @@ public class TutorTabViewModel {
@SerializedName("dutyHours")
private List<DutyHourViewModel> dutyHours = null;
public TutorTabViewModel(String userId, String note){
this.userId=userId;
// this.room=room;
// this.emailTutorTab=emailTutorTab;
this.note=note;
}
public TutorTabViewModel tutorTabId(UUID tutorTabId) {
this.tutorTabId = tutorTabId;
return this;
}
/**
* Get tutorTabId
* @return tutorTabId