Skip to content
Snippets Groups Projects
Commit 7d59df2f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '37-lih-data-processing' into 'master'

Resolve "LIH data processing"

Closes #37

See merge request !10
parents 0ac755df 35511587
No related branches found
No related tags found
1 merge request!10Resolve "LIH data processing"
Showing
with 207 additions and 36 deletions
...@@ -154,4 +154,9 @@ public class LihControlMappingParser extends SubjectParser { ...@@ -154,4 +154,9 @@ public class LihControlMappingParser extends SubjectParser {
return false; return false;
} }
@Override
protected boolean parsePostponed(Row row) {
return false;
}
} }
...@@ -5,7 +5,9 @@ import java.util.ArrayList; ...@@ -5,7 +5,9 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import org.apache.poi.ss.usermodel.Color;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFColor;
public class LihControlParser extends SubjectParser { public class LihControlParser extends SubjectParser {
...@@ -54,7 +56,7 @@ public class LihControlParser extends SubjectParser { ...@@ -54,7 +56,7 @@ public class LihControlParser extends SubjectParser {
return ""; return "";
} }
private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd"); private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd");
@Override @Override
protected String parseAddDate(Row row) { protected String parseAddDate(Row row) {
...@@ -123,6 +125,7 @@ public class LihControlParser extends SubjectParser { ...@@ -123,6 +125,7 @@ public class LihControlParser extends SubjectParser {
remarks.add(getComments(row.getCell(14))); remarks.add(getComments(row.getCell(14)));
remarks.add(getComments(row.getCell(15))); remarks.add(getComments(row.getCell(15)));
remarks.add(getComments(row.getCell(16))); remarks.add(getComments(row.getCell(16)));
remarks.add("Inclusion="+getString(row.getCell(17)));
remarks.add(getString(row.getCell(18))); remarks.add(getString(row.getCell(18)));
remarks.add(getString(row.getCell(19))); remarks.add(getString(row.getCell(19)));
String result = ""; String result = "";
...@@ -208,8 +211,51 @@ public class LihControlParser extends SubjectParser { ...@@ -208,8 +211,51 @@ public class LihControlParser extends SubjectParser {
return false; return false;
} }
@Override
protected boolean parsePostponed(Row row) {
Color color = row.getCell(0).getCellStyle().getFillForegroundColorColor();
if (color == null) {
return false;
}
XSSFColor c = (XSSFColor) color;
String colorString = c.getARGBHex().substring(2);
switch (colorString) {
case ("FFC000"):// orange
return false;
case ("FFFF00"):// yellow
return false;
case ("FF0000"):// red
return false;
case ("FF3399"):// pink
return true;
case ("00B050"):// green
return false;
}
throw new RuntimeException(parseName(row) + " " + parseSurname(row) + ": Unknown color: " + colorString);
}
@Override @Override
protected boolean parseResigned(Row row) { protected boolean parseResigned(Row row) {
return false; Color color = row.getCell(0).getCellStyle().getFillForegroundColorColor();
if (color == null) {
return false;
}
XSSFColor c = (XSSFColor) color;
String colorString = c.getARGBHex().substring(2);
switch (colorString) {
case ("FFC000"):// orange
return false;
case ("FFFF00"):// yellow
return false;
case ("FF0000"):// red
return true;
case ("FF3399"):// pink
return false;
case ("00B050"):// green
return false;
}
throw new RuntimeException(parseName(row) + " " + parseSurname(row) + ": Unknown color: " + colorString);
} }
} }
...@@ -157,4 +157,9 @@ public class PrcControlParser extends SubjectParser { ...@@ -157,4 +157,9 @@ public class PrcControlParser extends SubjectParser {
protected boolean parseResigned(Row row) { protected boolean parseResigned(Row row) {
return false; return false;
} }
@Override
protected boolean parsePostponed(Row row) {
return false;
}
} }
...@@ -163,5 +163,9 @@ public class PrcFlyingParser extends SubjectParser { ...@@ -163,5 +163,9 @@ public class PrcFlyingParser extends SubjectParser {
protected boolean parseResigned(Row row) { protected boolean parseResigned(Row row) {
return false; return false;
} }
@Override
protected boolean parsePostponed(Row row) {
return false;
}
} }
...@@ -205,4 +205,9 @@ public class PrcSubjectsParser extends SubjectParser { ...@@ -205,4 +205,9 @@ public class PrcSubjectsParser extends SubjectParser {
return false; return false;
} }
} }
@Override
protected boolean parsePostponed(Row row) {
return false;
}
} }
...@@ -32,6 +32,7 @@ public class Subject { ...@@ -32,6 +32,7 @@ public class Subject {
private String toBeSeenAt; private String toBeSeenAt;
private boolean dead = false; private boolean dead = false;
private boolean resigned = false; private boolean resigned = false;
private boolean postponed = false;
private List<String> languages = new ArrayList<>(); private List<String> languages = new ArrayList<>();
...@@ -476,6 +477,9 @@ public class Subject { ...@@ -476,6 +477,9 @@ public class Subject {
setAddDate(getMergedValue("addDate", this.getAddDate(), subject.getAddDate(), errorPrefix)); setAddDate(getMergedValue("addDate", this.getAddDate(), subject.getAddDate(), errorPrefix));
setmPowerId(getMergedValue("mPowerId", this.getmPowerId(), subject.getmPowerId(), errorPrefix)); setmPowerId(getMergedValue("mPowerId", this.getmPowerId(), subject.getmPowerId(), errorPrefix));
setType(getMergedValue("type", this.getType(), subject.getType(), errorPrefix)); setType(getMergedValue("type", this.getType(), subject.getType(), errorPrefix));
setResigned(this.isResigned()|| subject.isResigned());
setDead(this.isDead()|| subject.isDead());
setPostponed(this.isPostponed()|| subject.isPostponed());
// override only when to be seen by flying team // override only when to be seen by flying team
if (subject.getToBeSeenAt().equals("F")) { if (subject.getToBeSeenAt().equals("F")) {
setToBeSeenAt(subject.getToBeSeenAt()); setToBeSeenAt(subject.getToBeSeenAt());
...@@ -566,4 +570,20 @@ public class Subject { ...@@ -566,4 +570,20 @@ public class Subject {
} }
} }
/**
* @return the postponed
* @see #postponed
*/
public boolean isPostponed() {
return postponed;
}
/**
* @param postponed the postponed to set
* @see #postponed
*/
public void setPostponed(boolean postponed) {
this.postponed = postponed;
}
} }
...@@ -91,11 +91,13 @@ public abstract class SubjectParser { ...@@ -91,11 +91,13 @@ public abstract class SubjectParser {
result.setToBeSeenAt(parseToBeSeenAt(row)); result.setToBeSeenAt(parseToBeSeenAt(row));
result.setDead(parseDead(row)); result.setDead(parseDead(row));
result.setResigned(parseResigned(row)); result.setResigned(parseResigned(row));
result.setPostponed(parsePostponed(row));
return result; return result;
} }
protected abstract boolean parseDead(Row row); protected abstract boolean parseDead(Row row);
protected abstract boolean parsePostponed(Row row);
protected abstract boolean parseResigned(Row row); protected abstract boolean parseResigned(Row row);
......
...@@ -30,6 +30,7 @@ public class SubjectSqlExporter extends SqlExporter { ...@@ -30,6 +30,7 @@ public class SubjectSqlExporter extends SqlExporter {
result.append("dead,"); result.append("dead,");
result.append("default_written_communication_language_id,"); result.append("default_written_communication_language_id,");
result.append("resigned,"); result.append("resigned,");
result.append("postponed,");
result.append("date_born) "); result.append("date_born) ");
result.append("values ("); result.append("values (");
...@@ -74,6 +75,7 @@ public class SubjectSqlExporter extends SqlExporter { ...@@ -74,6 +75,7 @@ public class SubjectSqlExporter extends SqlExporter {
result.append("null,"); result.append("null,");
} }
result.append(subject.isResigned() + ","); result.append(subject.isResigned() + ",");
result.append(subject.isPostponed() + ",");
result.append(getDateVal(subject.getBirthDate())); result.append(getDateVal(subject.getBirthDate()));
result.append(");\n"); result.append(");\n");
......
...@@ -12,12 +12,14 @@ public class VisitSqlExporter extends SqlExporter { ...@@ -12,12 +12,14 @@ public class VisitSqlExporter extends SqlExporter {
result.append("subject_id, "); result.append("subject_id, ");
result.append("datetime_begin, "); result.append("datetime_begin, ");
result.append("datetime_end, "); result.append("datetime_end, ");
result.append("post_mail_sent, ");
result.append("is_finished)"); result.append("is_finished)");
result.append("values ("); result.append("values (");
result.append("(SELECT id from web_subject where screening_number = "+getStringVal(visit.getSubject().getScreeningNumber()) + "),"); result.append("(SELECT id from web_subject where screening_number = "+getStringVal(visit.getSubject().getScreeningNumber()) + "),");
result.append(getStringVal(visit.getStartDate()) + ","); result.append(getStringVal(visit.getStartDate()) + ",");
result.append(getStringVal(visit.getEndDate()) + ","); result.append(getStringVal(visit.getEndDate()) + ",");
result.append("false,");
result.append(visit.isFinished()); result.append(visit.isFinished());
result.append(");\n"); result.append(");\n");
for (AppointmentEntry entry: visit.getAppointments()) { for (AppointmentEntry entry: visit.getAppointments()) {
......
package smash.appointment.parse; package smash.appointment.parse;
import static org.junit.Assert.*; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.List; import java.util.List;
...@@ -11,17 +13,16 @@ import org.junit.Before; ...@@ -11,17 +13,16 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class LihControlParserTest extends TestBase { public class LihControlParserTest extends TestBase {
Logger logger = Logger.getLogger(LihControlParserTest.class); Logger logger = Logger.getLogger(LihControlParserTest.class);
LihControlParser processor = new LihControlParser();
LihControlParser processor = new LihControlParser();
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
} }
@Before @Before
public void setUp() { public void setUp() {
super.setUp(); super.setUp();
} }
...@@ -31,8 +32,9 @@ public class LihControlParserTest extends TestBase { ...@@ -31,8 +32,9 @@ public class LihControlParserTest extends TestBase {
@Test @Test
public void testParseLang() throws Exception { public void testParseLang() throws Exception {
assertEquals("English",processor.getMappedLanguage("EN")); assertEquals("English", processor.getMappedLanguage("EN"));
} }
@Test @Test
public void test() throws Exception { public void test() throws Exception {
List<Subject> entries = processor.processExcel("testFiles/lihControlExample.xlsx"); List<Subject> entries = processor.processExcel("testFiles/lihControlExample.xlsx");
...@@ -43,7 +45,7 @@ public class LihControlParserTest extends TestBase { ...@@ -43,7 +45,7 @@ public class LihControlParserTest extends TestBase {
assertEquals("Name", subject.getName()); assertEquals("Name", subject.getName());
assertEquals("Surname", subject.getSurname()); assertEquals("Surname", subject.getSurname());
assertTrue(subject.getRemarks().contains("001 rdv 01/09/2015 9h jyf")); assertTrue(subject.getRemarks().contains("001 rdv 01/09/2015 9h jyf"));
assertTrue(subject.getRemarks().contains("PD family relation=pd info")); assertTrue(subject.getRemarks().contains("PD family relation=pd info"));
assertEquals("11, Rue blabla", subject.getAddress()); assertEquals("11, Rue blabla", subject.getAddress());
assertEquals("L-3322", subject.getZipCode()); assertEquals("L-3322", subject.getZipCode());
assertEquals("Luxembourg", subject.getCity()); assertEquals("Luxembourg", subject.getCity());
...@@ -58,11 +60,9 @@ public class LihControlParserTest extends TestBase { ...@@ -58,11 +60,9 @@ public class LihControlParserTest extends TestBase {
assertNotNull(subject.getAddDate()); assertNotNull(subject.getAddDate());
assertEquals("", subject.getNdNumber()); assertEquals("", subject.getNdNumber());
assertEquals("1937-01-03", subject.getBirthDate()); assertEquals("1937-01-03", subject.getBirthDate());
assertTrue(subject.getRemarks().contains("some other remark")); assertTrue(subject.getRemarks().contains("some other remark"));
assertTrue(subject.getRemarks().contains("at home: NMS + RFQ 1 + RFQ 2 + REM + PDSS: manque une page ds RFQ => Linda pr level b 09/09/15")); assertTrue(subject.getRemarks().contains("at home: NMS + RFQ 1 + RFQ 2 + REM + PDSS: manque une page ds RFQ => Linda pr level b 09/09/15"));
assertTrue(subject.getLanguages().contains("French")); assertTrue(subject.getLanguages().contains("French"));
assertTrue(subject.getLanguages().contains("German")); assertTrue(subject.getLanguages().contains("German"));
} }
} }
...@@ -35,6 +35,11 @@ class SubjectAddForm(ModelForm): ...@@ -35,6 +35,11 @@ class SubjectAddForm(ModelForm):
required=False required=False
) )
datetime_contact_reminder = forms.DateField(label="Contact on",
widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"),
required=False
)
class Meta: class Meta:
model = Subject model = Subject
fields = '__all__' fields = '__all__'
...@@ -56,6 +61,11 @@ class SubjectDetailForm(ModelForm): ...@@ -56,6 +61,11 @@ class SubjectDetailForm(ModelForm):
class SubjectEditForm(ModelForm): class SubjectEditForm(ModelForm):
datetime_contact_reminder = forms.DateField(label="Contact on",
widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"),
required=False
)
date_born = forms.DateField(label="Date of birth", date_born = forms.DateField(label="Date of birth",
widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"),
required=False required=False
......
...@@ -10,6 +10,8 @@ from datetime import timedelta ...@@ -10,6 +10,8 @@ from datetime import timedelta
def get_current_year(): def get_current_year():
return datetime.datetime.now().year return datetime.datetime.now().year
BOOL_CHOICES = ((True, 'Yes'), (False, 'No'))
class Location (models.Model): class Location (models.Model):
name = models.CharField(max_length=20) name = models.CharField(max_length=20)
...@@ -81,6 +83,15 @@ class Subject(models.Model): ...@@ -81,6 +83,15 @@ class Subject(models.Model):
choices=SEX_CHOICES, choices=SEX_CHOICES,
verbose_name='Sex' verbose_name='Sex'
) )
postponed = models.BooleanField(choices=BOOL_CHOICES,
verbose_name='Postponed',
default=False
)
datetime_contact_reminder = models.DateField(
null=True,
blank=True,
verbose_name='Contact on',
)
type = models.CharField(max_length=1, type = models.CharField(max_length=1,
choices=SUBJECT_TYPE_CHOICES, choices=SUBJECT_TYPE_CHOICES,
verbose_name='Type' verbose_name='Type'
...@@ -122,17 +133,17 @@ class Subject(models.Model): ...@@ -122,17 +133,17 @@ class Subject(models.Model):
) )
phone_number_2 = models.CharField(max_length=20, phone_number_2 = models.CharField(max_length=20,
null=True, null=True,
blank=True, blank=True,
verbose_name='Phone number 2' verbose_name='Phone number 2'
) )
phone_number_3 = models.CharField(max_length=20, phone_number_3 = models.CharField(max_length=20,
null=True, null=True,
blank=True, blank=True,
verbose_name='Phone number 3' verbose_name='Phone number 3'
) )
email = models.EmailField( email = models.EmailField(
null=True, null=True,
blank=True, blank=True,
verbose_name='E-mail' verbose_name='E-mail'
) )
date_born = models.DateField( date_born = models.DateField(
...@@ -483,7 +494,6 @@ class Visit(models.Model): ...@@ -483,7 +494,6 @@ class Visit(models.Model):
verbose_name='Has ended', verbose_name='Has ended',
default=False default=False
) )
BOOL_CHOICES = ((True, 'Yes'), (False, 'No'))
post_mail_sent = models.BooleanField(choices=BOOL_CHOICES, post_mail_sent = models.BooleanField(choices=BOOL_CHOICES,
verbose_name='Post mail sent', verbose_name='Post mail sent',
default=False default=False
......
<tfoot> <tfoot>
<tr> <tr>
<th colspan="7" class="ts-pager form-inline"> <th colspan="8" class="ts-pager form-inline">
<div class="btn-group btn-group-sm" role="group"> <div class="btn-group btn-group-sm" role="group">
<button type="button" class="btn btn-default first"><span class="glyphicon glyphicon-step-backward"></span></button> <button type="button" class="btn btn-default first"><span class="glyphicon glyphicon-step-backward"></span></button>
<button type="button" class="btn btn-default prev"><span class="glyphicon glyphicon-backward"></span></button> <button type="button" class="btn btn-default prev"><span class="glyphicon glyphicon-backward"></span></button>
...@@ -19,4 +19,4 @@ ...@@ -19,4 +19,4 @@
<select class="form-control input-sm pagenum" title="Select page number"></select> <select class="form-control input-sm pagenum" title="Select page number"></select>
</th> </th>
</tr> </tr>
</tfoot> </tfoot>
\ No newline at end of file
...@@ -34,11 +34,10 @@ ...@@ -34,11 +34,10 @@
<th>Screening</th> <th>Screening</th>
<th>First name</th> <th>First name</th>
<th>Last name</th> <th>Last name</th>
<th>Country</th>
<th data-sorter="false" data-filter="false">Languages</th>
<th class="filter-select filter-exact" data-placeholder="Select location">Default location</th> <th class="filter-select filter-exact" data-placeholder="Select location">Default location</th>
<th>Dead</th> <th>Dead</th>
<th>Resigned</th> <th>Resigned</th>
<th>Postponed</th>
<th>Edit</th> <th>Edit</th>
</tr> </tr>
</thead> </thead>
...@@ -52,17 +51,10 @@ ...@@ -52,17 +51,10 @@
<td>{{ subject.screening_number }}</td> <td>{{ subject.screening_number }}</td>
<td>{{ subject.first_name }}</td> <td>{{ subject.first_name }}</td>
<td>{{ subject.last_name }}</td> <td>{{ subject.last_name }}</td>
<td>{{ subject.country }}</td>
<td>
{% autoescape off %}
{% for language in subject.languages.all %}
{{language.image_img}}
{% endfor %}
{% endautoescape %}
</td>
<td>{{ subject.get_default_appointment_location_display }}</td> <td>{{ subject.get_default_appointment_location_display }}</td>
<td>{% if subject.dead %} YES {% else %} NO {% endif %} </td> <td>{% if subject.dead %} YES {% else %} NO {% endif %} </td>
<td>{% if subject.resigned %} YES {% else %} NO {% endif %} </td> <td>{% if subject.resigned %} YES {% else %} NO {% endif %} </td>
<td>{% if subject.postponed %} YES {% else %} NO {% endif %} </td>
<td><a href="{% url 'web.views.subject_edit' subject.id %}" type="button" class="btn btn-block btn-default">Edit</a></td> <td><a href="{% url 'web.views.subject_edit' subject.id %}" type="button" class="btn btn-block btn-default">Edit</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
...@@ -94,10 +86,7 @@ ...@@ -94,10 +86,7 @@
filter_cssFilter: "form-control", filter_cssFilter: "form-control",
}, },
headers: { headers: {
5: { sorter: false}, 0: { sorter: true},
8: { sorter: false},
9: { sorter: false},
10: { sorter: false}
} }
}).tablesorterPager({ }).tablesorterPager({
container: $(".ts-pager"), container: $(".ts-pager"),
......
...@@ -253,3 +253,42 @@ class NotificationViewTests(TestCase): ...@@ -253,3 +253,42 @@ class NotificationViewTests(TestCase):
notification = get_approaching_visits_for_mail_contact_count(self.user) notification = get_approaching_visits_for_mail_contact_count(self.user)
self.assertEquals(original_notification.count, notification.count) self.assertEquals(original_notification.count, notification.count)
def test_get_subjects_with_reminder_count(self):
original_without_visit_notification = get_subject_with_no_visit_notifications_count(self.user)
original_notification = get_subjects_with_reminder_count(self.user)
subject = create_subject()
subject.datetime_contact_reminder = get_today_midnight_date()+datetime.timedelta(days=-1)
subject.save()
notification = get_subjects_with_reminder_count(self.user)
self.assertEquals(original_notification.count + 1, notification.count)
notification = get_subject_with_no_visit_notifications_count(self.user)
self.assertEquals(original_without_visit_notification.count, notification.count)
def test_get_subjects_with_reminder_count_2(self):
original_without_visit_notification = get_subject_with_no_visit_notifications_count(self.user)
original_notification = get_subjects_with_reminder_count(self.user)
subject = create_subject()
subject.datetime_contact_reminder = get_today_midnight_date()+datetime.timedelta(hours=23)
subject.save()
notification = get_subjects_with_reminder_count(self.user)
self.assertEquals(original_notification.count + 1, notification.count)
notification = get_subject_with_no_visit_notifications_count(self.user)
self.assertEquals(original_without_visit_notification.count, notification.count)
def test_get_subjects_with_reminder_count_3(self):
original_without_visit_notification = get_subject_with_no_visit_notifications_count(self.user)
original_notification = get_subjects_with_reminder_count(self.user)
subject = create_subject()
subject.datetime_contact_reminder = get_today_midnight_date()+datetime.timedelta(days=2)
subject.save()
notification = get_subjects_with_reminder_count(self.user)
self.assertEquals(original_notification.count, notification.count)
notification = get_subject_with_no_visit_notifications_count(self.user)
self.assertEquals(original_without_visit_notification.count, notification.count)
...@@ -42,6 +42,7 @@ urlpatterns = [ ...@@ -42,6 +42,7 @@ urlpatterns = [
url(r'^subjects$', views.subjects, name='web.views.subjects'), url(r'^subjects$', views.subjects, name='web.views.subjects'),
url(r'^subjects/no_visit$', views.subject_no_visits, name='web.views.subject_no_visits'), url(r'^subjects/no_visit$', views.subject_no_visits, name='web.views.subject_no_visits'),
url(r'^subjects/equire_contact$', views.subject_require_contact, name='web.views.subject_require_contact'),
url(r'^subjects/add$', views.subject_add, name='web.views.subject_add'), url(r'^subjects/add$', views.subject_add, name='web.views.subject_add'),
url(r'^subjects/subject_visit_details/(?P<id>\d+)$', views.subject_visit_details, name='web.views.subject_visit_details'), url(r'^subjects/subject_visit_details/(?P<id>\d+)$', views.subject_visit_details, name='web.views.subject_visit_details'),
url(r'^subjects/edit/(?P<id>\d+)$', views.subject_edit, name='web.views.subject_edit'), url(r'^subjects/edit/(?P<id>\d+)$', views.subject_edit, name='web.views.subject_edit'),
......
...@@ -120,10 +120,31 @@ def get_subjects_with_no_visit(user): ...@@ -120,10 +120,31 @@ def get_subjects_with_no_visit(user):
dead=False, dead=False,
resigned=False, resigned=False,
my_count=0, my_count=0,
default_location__in = get_filter_locations(user) default_location__in = get_filter_locations(user),
postponed=False,
datetime_contact_reminder__isnull=True,
) )
return result return result
def get_subjects_with_reminder(user):
tomorrow = get_today_midnight_date() + datetime.timedelta(days=1)
result = Subject.objects.filter(
dead=False,
resigned=False,
default_location__in = get_filter_locations(user),
datetime_contact_reminder__lt=tomorrow,
)
return result
def get_subjects_with_reminder_count(user):
notification = NotificationCount(
title = "subject required contact",
count = get_subjects_with_reminder(user).count(),
style = "fa fa-users text-aqua",
type = 'web.views.subject_require_contact')
return notification
def get_subject_with_no_visit_notifications_count(user): def get_subject_with_no_visit_notifications_count(user):
notification = NotificationCount( notification = NotificationCount(
title = "subject without visit", title = "subject without visit",
...@@ -251,6 +272,8 @@ def get_notifications(the_user): ...@@ -251,6 +272,8 @@ def get_notifications(the_user):
notifications.append(get_visits_with_missing_appointments_count(person)) notifications.append(get_visits_with_missing_appointments_count(person))
notifications.append(get_subject_with_no_visit_notifications_count(person)) notifications.append(get_subject_with_no_visit_notifications_count(person))
notifications.append(get_approaching_visits_for_mail_contact_count(person)) notifications.append(get_approaching_visits_for_mail_contact_count(person))
notifications.append(get_subjects_with_reminder_count(person))
for notification in notifications: for notification in notifications:
count += notification.count count += notification.count
...@@ -411,6 +434,14 @@ def subject_no_visits(request): ...@@ -411,6 +434,14 @@ def subject_no_visits(request):
return wrap_response(request, 'subjects/index.html', context) return wrap_response(request, 'subjects/index.html', context)
def subject_require_contact(request):
subjects_list = get_subjects_with_reminder(request.user).order_by('-last_name')
context = {
'subjects_list': subjects_list
}
return wrap_response(request, 'subjects/index.html', context)
def subject_edit(request, id): def subject_edit(request, id):
the_subject = get_object_or_404(Subject, id=id) the_subject = get_object_or_404(Subject, id=id)
if request.method == 'POST': if request.method == 'POST':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment