Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inclusion of abandoned and bookmark tables #211

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions turkle/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ def has_delete_permission(self, request, obj=None):


class TaskAssignmentAdmin(admin.ModelAdmin):
"""View for assignments to expire abandoned ones"""
"""View for assignments to expire open ones"""

class Media:
css = {
Expand All @@ -1225,17 +1225,17 @@ def changelist_view(self, request, extra_context=None):
return super().changelist_view(request, extra_context)

@staticmethod
def expire_abandoned_assignments(request):
(total_deleted, _) = TaskAssignment.expire_all_abandoned()
messages.info(request, 'All {} abandoned Tasks have been expired'.format(total_deleted))
def expire_open_assignments(request):
(total_deleted, _) = TaskAssignment.expire_all_open()
messages.info(request, 'All {} open Tasks have been expired'.format(total_deleted))
return redirect(reverse('admin:turkle_taskassignment_changelist'))

def get_urls(self):
urls = super().get_urls()
my_urls = [
path('expire_abandoned_assignments/',
self.admin_site.admin_view(self.expire_abandoned_assignments),
name='turkle_expire_abandoned_assignments'),
path('expire_open_assignments/',
self.admin_site.admin_view(self.expire_open_assignments),
name='turkle_expire_open_assignments'),
]
return my_urls + urls

Expand Down
4 changes: 2 additions & 2 deletions turkle/management/commands/expire_assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class Command(BaseCommand):

def handle(self, *args, **options):
t0 = datetime.now()
(total_deleted, _) = TaskAssignment.expire_all_abandoned()
(total_deleted, _) = TaskAssignment.expire_all_open()
t = datetime.now()
dt = (t - t0).total_seconds()
logging.basicConfig(format="%(asctime)-15s %(message)s", level=logging.INFO)
logging.info('TURKLE: Expired {0} abandoned Task Assignments in {1:.3f} seconds'.
logging.info('TURKLE: Expired {0} open Task Assignments in {1:.3f} seconds'.
format(total_deleted, dt))
3 changes: 2 additions & 1 deletion turkle/migrations/0014_bookmark.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.6 on 2023-11-14 13:41
# Generated by Django 4.2.6 on 2024-03-21 14:02

from django.conf import settings
from django.db import migrations, models
Expand Down Expand Up @@ -26,6 +26,7 @@ class Migration(migrations.Migration):
),
),
("bookmarked", models.BooleanField(default=False)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"batch",
models.ForeignKey(
Expand Down
3 changes: 2 additions & 1 deletion turkle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class Meta:
updated_at = models.DateTimeField(auto_now=True, db_index=True)

@classmethod
def expire_all_abandoned(cls):
def expire_all_open(cls):
result = cls.objects.\
filter(completed=False).\
filter(expires_at__lt=timezone.now()).\
Expand Down Expand Up @@ -944,3 +944,4 @@ class Bookmark(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
batch = models.ForeignKey(Batch, on_delete=models.CASCADE)
bookmarked = models.BooleanField(default=False)
updated_at = models.DateTimeField(auto_now=True)
2 changes: 1 addition & 1 deletion turkle/static/turkle/bootstrap-4.1.3/css/bootstrap.css.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions turkle/static/turkle/css/turkle.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,38 @@ div.task-preview {
background: #fff;
opacity: 0.8;
}
.table-alert{
margin-bottom: 0;
height: 100%;
}
.column-div {
float: left;
width: 50%;
min-width:500pt;
border-radius: 5px;
padding: 5pt;
position: relative;
overflow: hidden;
height: 100%;
}
.table-header, .table-body {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
}

.table-body-container {
min-height: 80pt;
height: 12vh;
overflow-y: auto;
}
.column-div th, td {
text-align: left;
padding: 8px;
}
.top-tables{
height: 25vh;
min-height: 175pt;
display: block;

}
4 changes: 2 additions & 2 deletions turkle/templates/admin/turkle/taskassignment/change_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</table>
</div>
<p class="mt-2">
<a href="{% url 'admin:turkle_expire_abandoned_assignments' %}" class="button">
Expire Abandoned Assignments
<a href="{% url 'admin:turkle_expire_open_assignments' %}" class="button">
Expire Open Assignments
</a>
</p>
{% endblock %}
Expand Down
6 changes: 4 additions & 2 deletions turkle/templates/turkle/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
{% load turkle_tags %}{% for tag in turkle_meta_tags %}{{ tag|meta_tag }}{% endfor %}
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'favicon-16x16.png' %}">
<link href="{% static "turkle/css/turkle.css" %}" rel="stylesheet" type="text/css"/>
<link href="{% static "turkle/bootstrap-4.1.3/css/bootstrap.min.css" %}" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.7/css/jquery.dataTables.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css">
<link href="{% static "turkle/bootstrap4-glyphicons/css/bootstrap-glyphicons.min.css" %}" rel="stylesheet" type="text/css"/>
<link href="{% static "turkle/css/turkle.css" %}" rel="stylesheet" type="text/css"/>
{% block head %}
{% endblock %}
</head>
Expand Down
2 changes: 1 addition & 1 deletion turkle/templates/turkle/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h5>Accept next Task</h5>
<hr>
<p>
The task is assigned to you.
If you do not finish it, you will be reminded on the main page that you have abandoned the task.
If you do not finish it, you will be reminded on the main page that you have open the task.
If you do not complete it by the deadline, it is returned to the task list.
</p>
</div>
Expand Down
Loading
Loading