From 1286cc27e4e7942723b0dc1cdad5c1d32f5313af Mon Sep 17 00:00:00 2001 From: sks444 <krishnasingh.ss30@gmail.com> Date: Mon, 2 Nov 2020 19:24:13 +0530 Subject: [PATCH] Add check to show add_determination button for submission --- hypha/apply/api/v1/serializers.py | 14 ++++++++++++-- hypha/static_src/src/app/src/redux/store.js | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hypha/apply/api/v1/serializers.py b/hypha/apply/api/v1/serializers.py index 59d9fc2e8..fbd09bd2d 100644 --- a/hypha/apply/api/v1/serializers.py +++ b/hypha/apply/api/v1/serializers.py @@ -4,12 +4,15 @@ from django_bleach.templatetags.bleach_tags import bleach_value from rest_framework import serializers from hypha.apply.activity.models import Activity +from hypha.apply.determinations.models import Determination +from hypha.apply.determinations.templatetags.determination_tags import ( + show_determination_button, +) from hypha.apply.determinations.views import DeterminationCreateOrUpdateView from hypha.apply.funds.models import ApplicationSubmission, RoundsAndLabs from hypha.apply.review.models import Review, ReviewOpinion from hypha.apply.review.options import RECOMMENDATION_CHOICES from hypha.apply.users.groups import PARTNER_GROUP_NAME, STAFF_GROUP_NAME -from hypha.apply.determinations.models import Determination User = get_user_model() @@ -195,7 +198,14 @@ class SubmissionDetailSerializer(serializers.ModelSerializer): obj.can_review(request.user) and not obj.assigned.draft_reviewed().filter(reviewer=request.user).exists() ) - return {'add_review': add_review} + add_determination = ( + show_determination_button(request.user, obj) and + obj.is_determination_form_attached + ) + return { + 'add_review': add_review, + 'add_determination': add_determination + } class SubmissionActionSerializer(serializers.ModelSerializer): diff --git a/hypha/static_src/src/app/src/redux/store.js b/hypha/static_src/src/app/src/redux/store.js index 41f507424..5b3922363 100644 --- a/hypha/static_src/src/app/src/redux/store.js +++ b/hypha/static_src/src/app/src/redux/store.js @@ -1,7 +1,7 @@ import { createStore, applyMiddleware } from 'redux' import ReduxThunk from 'redux-thunk' import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly' -import logger from 'redux-logger' +// import logger from 'redux-logger' import { routerMiddleware } from 'connected-react-router'; import { createBrowserHistory } from 'history'; import createSagaMiddleware from 'redux-saga'; -- GitLab