diff --git a/hypha/apply/funds/views.py b/hypha/apply/funds/views.py index 83dad0ce8f2bd3a4fd79b6a7eea3c1b2d3600cbf..44c6b5d12889995537d53a8134f72620cc6b5999 100644 --- a/hypha/apply/funds/views.py +++ b/hypha/apply/funds/views.py @@ -1124,7 +1124,11 @@ class SubmissionResultView(FilterView): return new_kwargs def get_queryset(self): - return self.filterset_class._meta.model.objects.current() + # For rounds we want all submissions but otherwise only current. + if self.request.GET.get('round'): + return self.filterset_class._meta.model.objects.all() + else: + return self.filterset_class._meta.model.objects.current() def get_context_data(self, **kwargs): search_term = self.request.GET.get('query') @@ -1144,14 +1148,24 @@ class SubmissionResultView(FilterView): ) def get_submission_values(self): + import re values = [] for submission in self.object_list: try: - value = int(submission.data('value')) - except (TypeError, ValueError): + value = submission.data('value') + except KeyError: value = 0 else: - if not value or value < 0: + value = str(value) + value = re.sub(r'[.,]\d{2}$', '', value) + value = value.replace('USD', '') + value = value.replace('$', '') + value = value.replace('-', '') + value = value.replace(',', '') + value = value.replace('.', '') + try: + value = int(value) + except (TypeError, ValueError): value = 0 finally: values.append(value)