<commit_before>/***************************************************************************
 *                                                                         *
 *   This program is free software: you can redistribute it and/or modify  *
 *   it under the terms of the GNU Affero General Public License as        *
 *   published by the Free Software Foundation, either version 3 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#include "constraintteachermincontinuousgapinintervalform.h"
#include "addconstraintteachersmincontinuousgapinintervalform.h"

#include "teacherstudentsetsubjectactivitytag_filterwidget.h"

#include "centerwidgetonscreen.h"

#include "fet.h"

ConstraintTeacherMinContinuousGapInIntervalForm::ConstraintTeacherMinContinuousGapInIntervalForm(QWidget *parent) : TimeConstraintBaseDialog(parent)
{
	//: This is the title of the dialog to see the list of all constraints of this type
	setWindowTitle("Constraints teacher min continuous gap in interval");

	TeacherStudentSetSubjectActivityTag_FilterWidget *filterWidget = new TeacherStudentSetSubjectActivityTag_FilterWidget(gt.rules);
	filterWidget->setTeachersVisible(true);
	setFilterWidget(filterWidget);
	connect(filterWidget, &TeacherStudentSetSubjectActivityTag_FilterWidget::FilterChanged, this, &ConstraintTeacherMinContinuousGapInIntervalForm::filterChanged);

	restoreFETDialogGeometry(this);
	filterChanged();
}

ConstraintTeacherMinContinuousGapInIntervalForm::~ConstraintTeacherMinContinuousGapInIntervalForm()
{
	saveFETDialogGeometry(this);
}

bool ConstraintTeacherMinContinuousGapInIntervalForm::filterOk(const TimeConstraint* ctr) const
{
	if(ctr->type == CONSTRAINT_TEACHER_MIN_CONTINUOUS_GAP_IN_INTERVAL)
		return true;
	else
		return false;
}

QDialog * ConstraintTeacherMinContinuousGapInIntervalForm::createAddDialog()
{
	return new AddConstraintTeachersMinContinuousGapInIntervalForm(this, false);
}

QDialog * ConstraintTeacherMinContinuousGapInIntervalForm::createModifyDialog(TimeConstraint *ctr)
{
	return new AddConstraintTeachersMinContinuousGapInIntervalForm(this, (ConstraintTeacherMinContinuousGapInInterval*)ctr);
}<commit_msg>fix filter for teacher min continuous gap in interval list dialog<commit_after>/***************************************************************************
 *                                                                         *
 *   This program is free software: you can redistribute it and/or modify  *
 *   it under the terms of the GNU Affero General Public License as        *
 *   published by the Free Software Foundation, either version 3 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#include "constraintteachermincontinuousgapinintervalform.h"
#include "addconstraintteachersmincontinuousgapinintervalform.h"

#include "teacherstudentsetsubjectactivitytag_filterwidget.h"

#include "centerwidgetonscreen.h"

#include "fet.h"

ConstraintTeacherMinContinuousGapInIntervalForm::ConstraintTeacherMinContinuousGapInIntervalForm(QWidget *parent) : TimeConstraintBaseDialog(parent)
{
	//: This is the title of the dialog to see the list of all constraints of this type
	setWindowTitle("Constraints teacher min continuous gap in interval");

	TeacherStudentSetSubjectActivityTag_FilterWidget *filterWidget = new TeacherStudentSetSubjectActivityTag_FilterWidget(gt.rules);
	filterWidget->setTeachersVisible(true);
	setFilterWidget(filterWidget);
	connect(filterWidget, &TeacherStudentSetSubjectActivityTag_FilterWidget::FilterChanged, this, &ConstraintTeacherMinContinuousGapInIntervalForm::filterChanged);

	restoreFETDialogGeometry(this);
	filterChanged();
}

ConstraintTeacherMinContinuousGapInIntervalForm::~ConstraintTeacherMinContinuousGapInIntervalForm()
{
	saveFETDialogGeometry(this);
}

bool ConstraintTeacherMinContinuousGapInIntervalForm::filterOk(const TimeConstraint* ctr) const
{
	if(ctr->type == CONSTRAINT_TEACHER_MIN_CONTINUOUS_GAP_IN_INTERVAL) {
		ConstraintTeacherMinContinuousGapInInterval *c = (ConstraintTeacherMinContinuousGapInInterval*)ctr;
		QString teacher = ((TeacherStudentSetSubjectActivityTag_FilterWidget*)getFilterWidget())->teacher();
		return teacher.isEmpty() || c->teacherName == teacher;
	}
	else
		return false;
}

QDialog * ConstraintTeacherMinContinuousGapInIntervalForm::createAddDialog()
{
	return new AddConstraintTeachersMinContinuousGapInIntervalForm(this, false);
}

QDialog * ConstraintTeacherMinContinuousGapInIntervalForm::createModifyDialog(TimeConstraint *ctr)
{
	return new AddConstraintTeachersMinContinuousGapInIntervalForm(this, (ConstraintTeacherMinContinuousGapInInterval*)ctr);
}
{'fraction_non_alphanumeric': 0.12439807383627609, 'fraction_numerical': 0.0004012841091492777, 'mean_word_length': 5.270440251572327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3522597', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1242, 'n_words': 256}