File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1818 < div class ="card ">
1919 < div class ="card-body ">
2020 < h6 class ="card-title "> {% trans "Configure Display Preferences" %}</ h6 >
21- < p > {% trans "Select which fields should be visible in your inventory view." %}</ p >
21+ < p > {% trans "Select which fields should be visible in your inventory/sharing view." %}</ p >
2222
2323 < form method ="POST " action ="">
2424 {% csrf_token %}
Original file line number Diff line number Diff line change @@ -77,7 +77,11 @@ def dashboard(request):
7777
7878 # Count the number of items shared by the user
7979 shared_items_count_by_you = ItemShare .objects .filter (shared_by = user ).values ('item' ).distinct ().count ()
80- shared_items_count_with_you = ItemShare .objects .filter (shared_with_user = user ).values ('item' ).distinct ().count ()
80+ shared_items_count_with_you = ItemShare .objects .filter (
81+ shared_with_user = user ,
82+ item__is_used = False ,
83+ item__expiry_date__gte = now ().date ()
84+ ).exclude (item__user = user ).values ('item' ).distinct ().count ()
8185
8286 # Get threshold days from environment variable or default to 30
8387 threshold_days = int (os .getenv ('EXPIRY_THRESHOLD_DAYS' , 30 ))
@@ -117,7 +121,11 @@ def show_items(request):
117121 if filter_value == 'shared_by_me' :
118122 items = Item .objects .filter (shared_with__shared_by = user ).distinct ()
119123 elif filter_value == 'shared_with_me' :
120- items = Item .objects .filter (shared_with__shared_with_user = user ).exclude (user = user ).distinct ()
124+ items = Item .objects .filter (
125+ shared_with__shared_with_user = user ,
126+ is_used = False ,
127+ expiry_date__gte = now ().date () # Only not expired
128+ ).exclude (user = user ).distinct ()
121129 elif filter_value == 'soon_expiring' :
122130 threshold_days = int (os .getenv ('EXPIRY_THRESHOLD_DAYS' , 30 ))
123131 soon_expiry_date = now () + timedelta (days = threshold_days )
You can’t perform that action at this time.
0 commit comments