fix hardcoded fieldname in taskDAO
This commit is contained in:
		
							parent
							
								
									9faea56056
								
							
						
					
					
						commit
						fec9565f69
					
				
					 2 changed files with 10 additions and 1 deletions
				
			
		|  | @ -9,3 +9,11 @@ data class Task( | ||||||
|     val time: Int = 0, |     val time: Int = 0, | ||||||
|     val subjectId: String = "", |     val subjectId: String = "", | ||||||
| ) | ) | ||||||
|  | 
 | ||||||
|  | object TaskDocument { | ||||||
|  |     const val id = "id" | ||||||
|  |     const val name = "name" | ||||||
|  |     const val completed = "completed" | ||||||
|  |     const val time = "time" | ||||||
|  |     const val subjectId = "subjectId" | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ package be.ugent.sel.studeez.domain.implementation | ||||||
| 
 | 
 | ||||||
| import be.ugent.sel.studeez.data.local.models.task.Subject | import be.ugent.sel.studeez.data.local.models.task.Subject | ||||||
| import be.ugent.sel.studeez.data.local.models.task.Task | import be.ugent.sel.studeez.data.local.models.task.Task | ||||||
|  | import be.ugent.sel.studeez.data.local.models.task.TaskDocument | ||||||
| import be.ugent.sel.studeez.domain.AccountDAO | import be.ugent.sel.studeez.domain.AccountDAO | ||||||
| import be.ugent.sel.studeez.domain.TaskDAO | import be.ugent.sel.studeez.domain.TaskDAO | ||||||
| import com.google.firebase.firestore.CollectionReference | import com.google.firebase.firestore.CollectionReference | ||||||
|  | @ -36,7 +37,7 @@ class FireBaseTaskDAO @Inject constructor( | ||||||
|     override fun toggleTaskCompleted(task: Task, completed: Boolean) { |     override fun toggleTaskCompleted(task: Task, completed: Boolean) { | ||||||
|         selectedSubjectTasksCollection(task.subjectId) |         selectedSubjectTasksCollection(task.subjectId) | ||||||
|             .document(task.id) |             .document(task.id) | ||||||
|             .update("completed", completed) |             .update(TaskDocument.completed, completed) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private fun selectedSubjectTasksCollection(subjectId: String): CollectionReference = |     private fun selectedSubjectTasksCollection(subjectId: String): CollectionReference = | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 brreynie
						brreynie