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

Survey-Question-Logic-Implemented #2262

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

sujalagrawal2
Copy link

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 anything

  • If you have multiple commits please combine them into one commit by squashing them.

Comment on lines 85 to 86
viewModel: SurveySubmitViewModel = hiltViewModel(),
queViewModel: SurveyQuestionViewModel = hiltViewModel(),
Copy link
Contributor

Choose a reason for hiding this comment

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

submitViewmodel
quesViewmodel / questionViewmodel

Comment on lines 89 to 90
val uiState2 by queViewModel.surveyQuestionUiState.collectAsStateWithLifecycle()
val uiState by viewModel.surveySubmitUiState.collectAsStateWithLifecycle()
Copy link
Contributor

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,
Copy link
Contributor

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.

@itsPronay
Copy link
Contributor

@sujalagrawal2 checks are failing. can you fix them?

@sujalagrawal2
Copy link
Author

@itsPronay checks have been fixed. Please review.

@itsPronay
Copy link
Contributor

itsPronay commented Jan 2, 2025

@itsPronay checks have been fixed. Please review.

@sujalagrawal2 still not fixed. Run
./gradlew spotlessApply and ./gradlew detekt after pulling the changes

@sujalagrawal2
Copy link
Author

@itsPronay please review

private val surveyQuestionRepository: SurveyQuestionRepository,
private val savedStateHandle: SavedStateHandle,
) : ViewModel() {
val surveyId = savedStateHandle.getStateFlow(key = Constants.CLIENT_ID, initialValue = -1)
Copy link
Contributor

Choose a reason for hiding this comment

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

set initial to 0

Comment on lines +48 to +50
data object ClientSurveyQuestionScreen : ClientScreens("client_survey_question_screen/{${Constants.CLIENT_ID}}") {
fun argument(surveyId: Int) = "client_survey_question_screen/$surveyId"
}
Copy link
Contributor

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 !?

Copy link
Contributor

@Darkeye14 Darkeye14 Jan 6, 2025

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??

Copy link
Contributor

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!?!

Copy link
Contributor

@itsPronay itsPronay Jan 6, 2025

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

Copy link
Contributor

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!!

Copy link
Contributor

@itsPronay itsPronay Jan 6, 2025

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>
Copy link
Contributor

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???

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

ha bhai

Comment on lines +48 to +50
data object ClientSurveyQuestionScreen : ClientScreens("client_survey_question_screen/{${Constants.CLIENT_ID}}") {
fun argument(surveyId: Int) = "client_survey_question_screen/$surveyId"
}
Copy link
Contributor

@Darkeye14 Darkeye14 Jan 6, 2025

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> {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here!

Comment on lines +48 to +50
data object ClientSurveyQuestionScreen : ClientScreens("client_survey_question_screen/{${Constants.CLIENT_ID}}") {
fun argument(surveyId: Int) = "client_survey_question_screen/$surveyId"
}
Copy link
Contributor

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
Copy link
Contributor

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.

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