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

1346 create recap pray and pay #4386

Merged
merged 55 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e87b883
working on backend for recap document request
v-anne Aug 30, 2024
e8d1b2e
working on tests
v-anne Aug 30, 2024
5556bde
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 30, 2024
4ef5294
Update views.py
v-anne Aug 30, 2024
16d5c2c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 30, 2024
8166f56
Merge branch 'main' into 1346-create-recap-pray-and-pay
v-anne Aug 30, 2024
6e2e0b9
env variable
v-anne Aug 30, 2024
d4ae7f0
Merge branch '1346-create-recap-pray-and-pay' of https://github.com/v…
v-anne Aug 30, 2024
ce262f9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 30, 2024
b06eb2e
Merge branch 'main' into 1346-create-recap-pray-and-pay
v-anne Aug 30, 2024
b284b7c
Update views.py
v-anne Aug 30, 2024
a5c685f
code to create dummy data
v-anne Sep 3, 2024
a8a3f25
Merge branch '1346-create-recap-pray-and-pay' of https://github.com/v…
v-anne Sep 3, 2024
e7391ad
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 3, 2024
5a06337
front end for pay and pray
v-anne Sep 11, 2024
92def1c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 11, 2024
7e6ce84
change to document ranking function
v-anne Sep 11, 2024
9aa6016
Merge branch '1346-create-recap-pray-and-pay' of https://github.com/v…
v-anne Sep 11, 2024
a2274fc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 11, 2024
b41b2ef
Merge branch 'main' into 1346-create-recap-pray-and-pay
v-anne Sep 11, 2024
8e75b64
undoing RECAPDocument factory change
v-anne Sep 11, 2024
fac87c5
adding DocketEntry to RECAPDocument factory
v-anne Sep 11, 2024
07a37e3
fixing another Factory issue
v-anne Sep 11, 2024
c477dde
Update signals.py
v-anne Sep 12, 2024
5666a1b
Merge branch 'main' into 1346-create-recap-pray-and-pay
v-anne Sep 13, 2024
fbd3b2a
adjusting is_available parameter in factories
v-anne Sep 13, 2024
3499aeb
Merge branch '1346-create-recap-pray-and-pay' of https://github.com/v…
v-anne Sep 13, 2024
584a3dc
Update factories.py
v-anne Sep 13, 2024
bbd788c
Update factories.py
v-anne Sep 13, 2024
970efe6
Update signals.py
v-anne Sep 13, 2024
52a083e
Update signals.py
v-anne Sep 13, 2024
f9b7eaa
Update factories.py
v-anne Sep 13, 2024
4b27e5b
Update factories.py
v-anne Sep 13, 2024
3f8dc65
Merge branch 'main' into 1346-create-recap-pray-and-pay
v-anne Sep 13, 2024
89a7135
Merge branch '1346-create-recap-pray-and-pay' of https://github.com/v…
v-anne Sep 13, 2024
daa1b42
minor factory changes
v-anne Sep 13, 2024
1e4c5cf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 13, 2024
117d089
Merge branch 'main' into 1346-create-recap-pray-and-pay
v-anne Sep 13, 2024
7bef842
Merge branch 'main' into 1346-create-recap-pray-and-pay
v-anne Sep 14, 2024
d7ca210
making prayer page private temporarily
v-anne Sep 14, 2024
f82ddfa
Merge branch 'main' into 1346-create-recap-pray-and-pay
v-anne Sep 14, 2024
b4b3dd2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 14, 2024
8be05ee
Merge branch 'main' into 1346-create-recap-pray-and-pay
albertisfu Sep 20, 2024
d308996
fix(favorites): Refactor Prayer methods and added related tests.
albertisfu Sep 20, 2024
76c4a63
Merge branch 'main' into 1346-create-recap-pray-and-pay
v-anne Sep 21, 2024
8a36f56
making changes as suggested by Mike, after Alberto's work
v-anne Sep 21, 2024
f63d42a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 21, 2024
e051bda
ensuring users can only request a document once
v-anne Sep 21, 2024
53bff8e
Merge branch '1346-create-recap-pray-and-pay' of https://github.com/v…
v-anne Sep 21, 2024
a8951f7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 21, 2024
c00ef7e
another constraint
v-anne Sep 21, 2024
bead765
migration for prayer model after adding unique constraint
v-anne Sep 21, 2024
e2919e8
Merge branch 'main' into 1346-create-recap-pray-and-pay
v-anne Sep 22, 2024
07e7f4c
fix(favorites): Tweak create_prayer method and added test case
albertisfu Sep 23, 2024
0763a68
Update views.py
v-anne Sep 23, 2024
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
8 changes: 7 additions & 1 deletion cl/favorites/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from cl.favorites.models import DocketTag, Note, UserTag
from cl.favorites.models import DocketTag, Note, Prayer, UserTag


class NoteInline(admin.TabularInline):
Expand Down Expand Up @@ -49,3 +49,9 @@ class UserTagAdmin(admin.ModelAdmin):
class UserTagInline(admin.StackedInline):
model = UserTag
extra = 0


@admin.register(Prayer)
class PrayerAdmin(admin.ModelAdmin):
raw_id_fields = ("user", "recap_document")
readonly_fields = ("date_created",)
17 changes: 15 additions & 2 deletions cl/favorites/factories.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from factory import Faker, SubFactory
from factory.django import DjangoModelFactory

from cl.favorites.models import Note, UserTag
from cl.search.factories import OpinionClusterWithParentsFactory
from cl.favorites.models import Note, Prayer, UserTag
from cl.search.factories import (
OpinionClusterWithParentsFactory,
RECAPDocumentFactory,
)
from cl.users.factories import UserWithChildProfileFactory


Expand All @@ -19,3 +22,13 @@ class Meta:
class UserTagFactory(DjangoModelFactory):
class Meta:
model = UserTag


class PrayerFactory(DjangoModelFactory):
class Meta:
model = Prayer

date_created = Faker("date_time_this_year")
user = SubFactory(UserWithChildProfileFactory)
recap_document = SubFactory(RECAPDocumentFactory)
status = Faker("random_element", elements=[Prayer.WAITING, Prayer.GRANTED])
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 5.0.8 on 2024-09-21 15:16

from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
(
"favorites",
"0007_rename_prayer_recap_document_status_favorites_p_recap_d_00e8c5_idx_and_more",
),
("search", "0034_add_harvard_pdf_to_opinioncluster"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.AddConstraint(
model_name="prayer",
constraint=models.UniqueConstraint(
fields=("user", "recap_document"),
name="unique_prayer_for_user_document",
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BEGIN;
--
-- Create constraint unique_prayer_for_user_document on model prayer
--
ALTER TABLE "favorites_prayer" ADD CONSTRAINT "unique_prayer_for_user_document" UNIQUE ("user_id", "recap_document_id");
COMMIT;
6 changes: 6 additions & 0 deletions cl/favorites/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ class Prayer(models.Model):
)

class Meta:
constraints = [
models.UniqueConstraint(
fields=["user", "recap_document"],
name="unique_prayer_for_user_document",
),
]
indexes = [
# When adding a new document to RECAP, we'll ask: What outstanding
# prayers do we have for this document?
Expand Down
44 changes: 44 additions & 0 deletions cl/favorites/templates/top_prayers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{% extends "base.html" %}
{% load extras %}
{% load text_filters %}
{% load static %}


{% block title %}RECAP Requests – CourtListener.com{% endblock %}
{% block og_title %}RECAP Requests – CourtListener.com{% endblock %}

{% block description %}Lorem Ipsum on CourtListener.{% endblock %}
{% block og_description %}Lorem Ipsum on CourtListener.{% endblock %}

{% block content %}
<div class="col-xs-12">
<div class="table-responsive">
<table class="settings-table table">
<thead>
<tr>
<th>User Preference</th>
<th>Document Description</th>
<th>Document Number</th>
<th>PACER Doc ID</th>
<th>Document Court</th>
</tr>
</thead>
<tbody>
{% for prayer in top_prayers %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{ prayer.description }}</td>
<td>{{ prayer.document_number }}</td>
<td>{{ prayer.pacer_doc_id }}</td>
<td>{{ prayer.docket_entry.docket.court_id }}</td>
</tr>
{% empty %}
<tr>
<td colspan="2">No document requests open. Consider making one!</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
Loading
Loading