-
Notifications
You must be signed in to change notification settings - Fork 602
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
Survey-Question-Logic-Implemented #2262
base: master
Are you sure you want to change the base?
Survey-Question-Logic-Implemented #2262
Conversation
viewModel: SurveySubmitViewModel = hiltViewModel(), | ||
queViewModel: SurveyQuestionViewModel = hiltViewModel(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
submitViewmodel
quesViewmodel / questionViewmodel
val uiState2 by queViewModel.surveyQuestionUiState.collectAsStateWithLifecycle() | ||
val uiState by viewModel.surveySubmitUiState.collectAsStateWithLifecycle() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
choose an appropriate name, don't just do uiState , uiState2. its confusing,
@@ -79,68 +81,107 @@ import java.util.Date | |||
@Composable | |||
internal fun SurveyQuestionScreen( | |||
navigateBack: () -> Unit, | |||
survey: Survey?, | |||
id: Int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont pass id
in here, retrieve it from viewmodel.
…tation-Issue # Conflicts: # core/data/src/main/java/com/mifos/core/data/di/DataModule.kt
…c-Implementation-Issue' into MIFOSAC-292-Survey-Question-Logic-Implementation-Issue
@sujalagrawal2 checks are failing. can you fix them? |
@itsPronay checks have been fixed. Please review. |
@sujalagrawal2 still not fixed. Run |
@itsPronay please review |
private val surveyQuestionRepository: SurveyQuestionRepository, | ||
private val savedStateHandle: SavedStateHandle, | ||
) : ViewModel() { | ||
val surveyId = savedStateHandle.getStateFlow(key = Constants.CLIENT_ID, initialValue = -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set initial to 0
data object ClientSurveyQuestionScreen : ClientScreens("client_survey_question_screen/{${Constants.CLIENT_ID}}") { | ||
fun argument(surveyId: Int) = "client_survey_question_screen/$surveyId" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client ID? shouldn't this be survey_id !?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nahi bhai, I think clientid is correct??? We are taking the survey for that particular client right??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Darkeye14 Correct me if I am wrong, but on line 49 we are passing surveyId right?? Even in the ViewModel, we are retrieving that value and storing it in the surveyId variable. however on line 48, it says Client_ID
Shouldn’t both be the same!?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea in my opinion both should be the same.. either survey_id or client_id depending on what we are passing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nahi bhai, i think this is correct!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh... my apologies. I didn't see we are using 2 view models here. @sujalagrawal2 its correct
|
||
interface SurveyQuestionRepository { | ||
|
||
fun getSurvey(surveyId: Int): Observable<Survey> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itsPronay bhai, what do you say about using Flow instead of Observables???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea bhai, we can use that. but it shouldn't be an issue now i guess, since we are using Observable in the whole project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha bhai
data object ClientSurveyQuestionScreen : ClientScreens("client_survey_question_screen/{${Constants.CLIENT_ID}}") { | ||
fun argument(surveyId: Int) = "client_survey_question_screen/$surveyId" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nahi bhai, I think clientid is correct??? We are taking the survey for that particular client right??
class SurveyQuestionRepositoryImp @Inject constructor(private val dataManagerSurveys: DataManagerSurveys) : | ||
SurveyQuestionRepository { | ||
|
||
override fun getSurvey(surveyId: Int): Observable<Survey> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here!
data object ClientSurveyQuestionScreen : ClientScreens("client_survey_question_screen/{${Constants.CLIENT_ID}}") { | ||
fun argument(surveyId: Int) = "client_survey_question_screen/$surveyId" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nahi bhai, i think this is correct!!
@@ -105,7 +106,8 @@ fun Navigation( | |||
hasDatatables = navController::navigateDataTableList, | |||
onDocumentClicked = navController::navigateToDocumentListScreen, | |||
onCardClicked = { position, survey -> | |||
// TODO | |||
val id: Int = survey[position].id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theres no need to explicitly specify the data type, i think. just a suggestion tho.
Fixes JIRA
Please Add Screenshots If there are any UI changes.
survey_question_video.mp4
Please make sure these boxes are checked before submitting your pull request - thanks!
Apply the
MifosStyle.xml
style template to your code in Android Studio.Run the unit tests with
./gradlew check
to make sure you didn't break anythingIf you have multiple commits please combine them into one commit by squashing them.