This commit is contained in:
Hillel Coren 2020-10-18 18:35:15 +03:00
parent 674b6bc883
commit 9c910ce9c3
4 changed files with 5 additions and 11 deletions

View File

@ -52,11 +52,6 @@ class TaskRepository {
}
Future<TaskEntity> saveData(Credentials credentials, TaskEntity task) async {
// Workaround for API issue
if (task.isNew) {
task = task.rebuild((b) => b..id = null);
}
final data = serializers.serializeWith(TaskEntity.serializer, task);
dynamic response;

View File

@ -184,9 +184,9 @@ double taskRateSelector(
{CompanyEntity company, ProjectEntity project, ClientEntity client}) {
if (project != null && project.taskRate > 0) {
return project.taskRate;
} else if (client != null && client.settings.defaultTaskRate > 0) {
} else if (client != null && (client.settings.defaultTaskRate ?? 0) > 0) {
return client.settings.defaultTaskRate;
} else if (company != null && company.settings.defaultTaskRate > 0) {
} else if (company != null && (company.settings.defaultTaskRate ?? 0) > 0) {
return company.settings.defaultTaskRate;
}

View File

@ -89,7 +89,7 @@ class _TaskViewState extends State<TaskView> {
List<Widget> _buildView() {
final widgets = <Widget>[
EntityHeader(
entity: project,
entity: task,
statusColor: task.isInvoiced
? Colors.green
: task.isRunning

View File

@ -60,8 +60,7 @@ class TaskViewVM {
factory TaskViewVM.fromStore(Store<AppState> store) {
final state = store.state;
final task = state.taskState.map[state.taskUIState.selectedId] ??
TaskEntity(id: state.taskUIState.selectedId);
final task = state.taskState.get(state.taskUIState.selectedId);
final client = state.clientState.map[task.clientId];
final project = state.projectState.map[task.projectId];