<commit_before><commit_msg>added refresh survey task<commit_after>package org.chai.task

import org.chai.task.Task.TaskStatus;
import org.chai.kevin.data.Calculation;
import org.chai.kevin.data.Data;
import org.chai.kevin.data.NormalizedDataElement;
import org.chai.kevin.location.Location;
import org.chai.kevin.security.User;
import org.chai.kevin.survey.Survey;

class RefreshSurveyTask extends Task {

	def surveyPageService
	
	Boolean closeIfComplete
	Boolean reset
	Integer locationId
	Integer surveyId
	
	public RefreshSurveyTask() {
		super();
	}
	
	def executeTask() {
		Task.withTransaction {
			def survey = Survey.get(surveyId)
			def location = Location.get(locationId)
			
			if (survey != null && location != null) {
				surveyPageService.refresh(
					location, survey, 
					closeIfComplete==null?false:closeIfComplete, 
					reset==null?false:reset, 
					this
				);
			}
		}
	}
	
	String getInformation() {
		return ''
	}
	
	boolean isUnique() {
		return true;
	}
	
	def cleanTask() {
		// nothing to do here
	}
	
	String getOutputFilename() {
		return null
	}
	
	String getFormView() {
		return null
	}
	
	Map getFormModel() {
		return null
	}
	
	static constraints = {
		reset(nullable: true)
		closeIfComplete(nullable: true)
	}
}

{'fraction_non_alphanumeric': 0.10446570972886762, 'fraction_numerical': 0.0, 'mean_word_length': 3.613970588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4260899', 'n_tokens_mistral': 483, 'n_tokens_neox': 418, 'n_words': 87}