From ba5d40430ad83008ebc261ec22568d5fe53da6a5 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a.beckmann@fz-juelich.de>
Date: Thu, 29 Apr 2021 23:06:38 +0200
Subject: [PATCH] do not assign unsuitable candidates with weight 0.0

---
 prepare-selection.sh | 2 +-
 sohpc-assign.pl      | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/prepare-selection.sh b/prepare-selection.sh
index 5f8ac3c..4399784 100755
--- a/prepare-selection.sh
+++ b/prepare-selection.sh
@@ -25,7 +25,7 @@ perl sohpc-assign.pl slots.csv weights-pref.csv  students.csv project-preference
 
 # apply tentative selections
 if true ; then
-	sed -n -e '1aID,selected' -e 's/\([0-9\.]\{4,\}\)[: ]\{1,\}\([0-9]\{1,\}\).*/-\2,\1/p' select-by-pref.txt > assign-t.csv
+	sed -n -e '1aID,selected' -e 's/\([0-9\.]\{4,\}\)[: ]\{1,\}\([1-9][0-9]\{0,\}\).*/-\2,\1/p' select-by-pref.txt > assign-t.csv
 	rm -rf Selection
 	mkdir Selection
 	cd Selection
diff --git a/sohpc-assign.pl b/sohpc-assign.pl
index 0cb3f29..3555961 100755
--- a/sohpc-assign.pl
+++ b/sohpc-assign.pl
@@ -147,6 +147,7 @@ while (@todo) {
 		next if defined $project2student{$p}{$slot};
 		foreach $c (@{$project{$p}{cand}}) {
 			next if defined $student2project{$c->{student}};
+			next unless $c->{value} > 0;
 			push @cand, {project => $p, slot => $slot, student => $c, value => $c->{value} + max_score({%project2student, $p => {%{$project2student{$p}}, $slot => $c->{student}}}, {%student2project, $c->{student} => $p})};
 		}
 	}
-- 
GitLab