aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOgnjen Cirkovic <ciraboxkg@gmail.com>2022-12-08 14:58:31 +0100
committerOgnjen Cirkovic <ciraboxkg@gmail.com>2022-12-08 14:58:31 +0100
commit5890d30b3bb77175d114e7c0630ec4038154365c (patch)
tree61facd19ff9bc0bbb2107d505f13dcb35689b784
parentf9d930da33a4a31aac2578b9943271d6340623d2 (diff)
Dodat broj omiljenih objava na back-u. Napravljen dizajn fragmenta za prikaz statistike
-rw-r--r--Backend/Api/Api/Models/User.cs1
-rw-r--r--Backend/Api/Api/Services/PostService.cs3
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_calendar_month_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_24.xml2
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_half_24.xml5
-rw-r--r--Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml88
7 files changed, 100 insertions, 9 deletions
diff --git a/Backend/Api/Api/Models/User.cs b/Backend/Api/Api/Models/User.cs
index 52d0f24..620c9c8 100644
--- a/Backend/Api/Api/Models/User.cs
+++ b/Backend/Api/Api/Models/User.cs
@@ -82,6 +82,7 @@ namespace Api.Models
public int numberOfRatingsOnPosts { get; set; }
public double averagePostRatingOnPosts {get; set; }
public List<MonthlyViews> monthlyViews { get; set; }
+ public int numberOfFavouritePosts { get; set; }
}
public class MonthlyViews
diff --git a/Backend/Api/Api/Services/PostService.cs b/Backend/Api/Api/Services/PostService.cs
index 0799f10..16ebbb7 100644
--- a/Backend/Api/Api/Services/PostService.cs
+++ b/Backend/Api/Api/Services/PostService.cs
@@ -672,6 +672,7 @@ namespace Api.Services
stats.numberOfPosts = 0;
stats.totalViews = 0;
stats.monthlyViews = new List<MonthlyViews>();
+ stats.numberOfFavouritePosts = 0;
if(posts != null)
@@ -691,6 +692,8 @@ namespace Api.Services
stats.totalViews += post.views;
stats.numberOfRatingsOnPosts += post.ratingscount;
stats.numberOfPosts++;
+ if(post.favourites!=null)
+ stats.numberOfFavouritePosts+=post.favourites.Count;
ratingsum += post.ratings * post.ratingscount;
}
if(stats.numberOfRatingsOnPosts > 0) //don't forget to check div by 0 jesus
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_calendar_month_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_calendar_month_24.xml
new file mode 100644
index 0000000..a278444
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_calendar_month_24.xml
@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#747474"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M19,4h-1V2h-2v2H8V2H6v2H5C3.89,4 3.01,4.9 3.01,6L3,20c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V6C21,4.9 20.1,4 19,4zM19,20H5V10h14V20zM9,14H7v-2h2V14zM13,14h-2v-2h2V14zM17,14h-2v-2h2V14zM9,18H7v-2h2V18zM13,18h-2v-2h2V18zM17,18h-2v-2h2V18z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_24.xml
index 84df34b..2dbc440 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_24.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_favorite_24.xml
@@ -1,4 +1,4 @@
-<vector android:height="24dp" android:tint="#E52121"
+<vector android:height="24dp" android:tint="#747474"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_24.xml
new file mode 100644
index 0000000..88f8d7a
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_24.xml
@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#747474"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_half_24.xml b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_half_24.xml
new file mode 100644
index 0000000..d532b23
--- /dev/null
+++ b/Client/BrzoDoLokacije/app/src/main/res/drawable/ic_baseline_star_half_24.xml
@@ -0,0 +1,5 @@
+<vector android:autoMirrored="true" android:height="24dp"
+ android:tint="#747474" android:viewportHeight="24"
+ android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M22,9.24l-7.19,-0.62L12,2L9.19,8.63L2,9.24l5.46,4.73L5.82,21L12,17.27L18.18,21l-1.63,-7.03L22,9.24zM12,15.4V6.1l1.71,4.04l4.38,0.38l-3.32,2.88l1,4.28L12,15.4z"/>
+</vector>
diff --git a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml
index d5d72d1..fc1152b 100644
--- a/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml
+++ b/Client/BrzoDoLokacije/app/src/main/res/layout/fragment_profile_statistics.xml
@@ -23,7 +23,17 @@
<TextView
android:layout_width="100dp"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:layout_marginRight="5dp"
+ android:text="Broj pregleda"
+ android:gravity="center"/>
+ <TextView
+ android:id="@+id/tvProfileStatisticsViews"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:text="0"
+ android:textSize="20dp"
+ android:gravity="center"/>
</LinearLayout>
@@ -39,11 +49,21 @@
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
- android:src="@drawable/ic_total_views" />
+ android:src="@drawable/ic_baseline_star_24" />
<TextView
android:layout_width="100dp"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:layout_marginRight="5dp"
+ android:text="Broj ocena"
+ android:gravity="center"/>
+ <TextView
+ android:id="@+id/tvProfileStatisticsRatingNumber"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:text="0"
+ android:textSize="20dp"
+ android:gravity="center"/>
</LinearLayout>
@@ -59,11 +79,52 @@
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
- android:src="@drawable/ic_total_views" />
+ android:src="@drawable/ic_baseline_star_half_24" />
+
+ <TextView
+ android:layout_width="100dp"
+ android:layout_height="match_parent"
+ android:layout_marginRight="5dp"
+ android:text="Prosečna ocena po objavi"
+ android:gravity="center"/>
+ <TextView
+ android:id="@+id/tvProfileStatisticsAverageRating"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:text="0"
+ android:textSize="20dp"
+ android:gravity="center"/>
+
+
+ </LinearLayout>
+ <LinearLayout
+ android:id="@+id/linearLayout7"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/linearLayout5">
+
+ <ImageView
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:src="@drawable/ic_baseline_favorite_24" />
<TextView
android:layout_width="100dp"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:layout_marginRight="5dp"
+ android:text="Broj omiljenih objava"
+ android:gravity="center"/>
+ <TextView
+ android:id="@+id/tvProfileStatisticsFavouriteNumber"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:text="0"
+ android:textSize="20dp"
+ android:gravity="center"/>
+
</LinearLayout>
@@ -74,18 +135,29 @@
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/linearLayout5">
+ app:layout_constraintTop_toBottomOf="@+id/linearLayout7">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
- android:src="@drawable/ic_total_views" />
+ android:src="@drawable/ic_baseline_calendar_month_24" />
<TextView
android:layout_width="100dp"
- android:layout_height="match_parent" />
+ android:layout_marginRight="5dp"
+ android:layout_height="match_parent"
+ android:text="Pregledi po mesecima"
+ android:gravity="center"/>
</LinearLayout>
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/rvFragmentProfileStatisticsMonths"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/linearLayout6" />
+
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file