[UPDT] not allow employees from answering feedback if it does not sta… (#491)

* [UPDT] not allow employees from answering feedback if it does not started yet

* [FIX] fix holiday edit form it raise error for missing company_id field

---------

Co-authored-by: Mahmoud Nasser <mahmoudnasser@Mahmouds-MacBook-Air.local>
This commit is contained in:
Mahmoud Nasser Abdulhamed
2025-02-17 13:11:58 +02:00
committed by GitHub
parent b3ba239272
commit 288f1fc030
2 changed files with 11 additions and 1 deletions

View File

@@ -1828,9 +1828,15 @@ def feedback_answer_get(request, id, **kwargs):
it will redirect to feedaback_answer.html .
"""
feedback = Feedback.objects.get(id=id)
# check if the feedback start_date is not started yet
if feedback.start_date > datetime.date.today():
messages.info(request, _("Feedback not started yet"))
return redirect(feedback_list_view)
user = request.user
employee = Employee.objects.filter(employee_user_id=user).first()
feedback = Feedback.objects.get(id=id)
answer = Answer.objects.filter(feedback_id=feedback, employee_id=employee)
question_template = feedback.question_template_id
questions = question_template.question.all()