Skip to content
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
6 changes: 3 additions & 3 deletions app/lib/pages/apps/app_detail/app_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ class _AppDetailPageState extends State<AppDetailPage> {
Column(
children: [
RatingBar.builder(
initialRating: 4.2,
initialRating: widget.app.ratingAvg ?? 0,
minRating: 1,
ignoreGestures: true,
direction: Axis.horizontal,
Expand All @@ -494,7 +494,7 @@ class _AppDetailPageState extends State<AppDetailPage> {
onRatingUpdate: (rating) {},
),
const SizedBox(height: 4),
Text("${widget.app.ratingCount}+ ratings"),
Text(widget.app.ratingCount <= 0 ? "no ratings" : "${widget.app.ratingCount}+ ratings"),
],
),
],
Expand All @@ -508,7 +508,7 @@ class _AppDetailPageState extends State<AppDetailPage> {
),
),
),
!widget.app.isOwner(SharedPreferencesUtil().uid)
!widget.app.isOwner(SharedPreferencesUtil().uid) && (widget.app.enabled || widget.app.userReview != null)
? AddReviewWidget(app: widget.app)
: const SizedBox.shrink(),
// isIntegration ? const SizedBox(height: 16) : const SizedBox.shrink(),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/pages/apps/app_detail/reviews_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _ReviewsListPageState extends State<ReviewsListPage> {
physics: const NeverScrollableScrollPhysics(),
itemCount: filteredReviews.length,
itemBuilder: (context, index) {
if (!widget.app.isOwner(SharedPreferencesUtil().uid)) {
if (widget.app.isOwner(SharedPreferencesUtil().uid)) {
return AppOwnerReviewCard(
review: filteredReviews[index],
appId: widget.app.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class _AppOwnerReviewCardState extends State<AppOwnerReviewCard> {
Text(
timeago.format(widget.review.ratedAt),
style: const TextStyle(
color: Colors.white,
color: Colors.grey,
fontSize: 12,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class UserReviewCard extends StatelessWidget {
Text(
timeago.format(review.ratedAt),
style: const TextStyle(
color: Colors.white,
color: Colors.grey,
fontSize: 12,
),
),
Expand Down
9 changes: 6 additions & 3 deletions backend/routers/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,16 @@ def update_app_review(app_id: str, data: dict, uid: str = Depends(auth.get_curre

if app.private and app.uid != uid:
raise HTTPException(status_code=403, detail='You are not authorized to review this app')

old_review = get_specific_user_review(app_id, uid)
if not old_review:
raise HTTPException(status_code=404, detail='Review not found')
review_data = {
'score': data['score'],
'review': data.get('review', ''),
'username': data.get('username', ''),
'response': data.get('response', ''),
'updated_at': datetime.now(timezone.utc).isoformat(),
'rated_at': old_review['rated_at'],
'username': old_review['username'],
'response': old_review['response'],
'uid': uid
}
set_app_review(app_id, uid, review_data)
Expand Down