Commit Graph

145 Commits

Author SHA1 Message Date
138d610c3a chore: remove unused job classes
- Delete BatchGenerateWeatherArtsJob which queued jobs for generating
  weather art for eligible cities.
- Remove CleanAhoyDataJob responsible for cleaning up old Ahoy events
  and visits.
- Eliminate GenerateWeatherArtJob that managed the generation
  and attachment of weather art images.
- Drop RefreshSitemapJob which created and uploaded XML sitemaps.

These removals suggest a shift in how these functionalities will be
handled, possibly indicating a move towards a different architecture
or integration with another service.
2025-01-28 01:50:49 +08:00
c332230709 feat: enhance city localization and timezone handling
- Update localized_name method to provide a default value for
  missing translations
- Modify timezone display in city show view to show a message
  when the timezone is undefined

These changes improve user experience by ensuring that the city
localization falls back to the city name itself if a translation
is not found, and they handle potentially missing timezone data
more gracefully.
2025-01-28 01:49:13 +08:00
f0f94de528 feat: refactor code organization and query complexity
- Simplify query for most popular inactive cities in City model
    - Minor layout changes in Admin Dashboards for Ahoy and Sidekiq tasks

    This refactoring improves code organization, reducing complexity in the City model and making it easier to read. Additionally, the Admin dashboard layouts have been simplified for a better user experience.
2025-01-28 01:44:07 +08:00
069b6d4a4f feat: add ahoy dashboard and city statistics
- Introduce a new admin dashboard for viewing Ahoy statistics.
- Display total visits, event counts, and unique visitors.
- List most popular and least popular active cities with their visit counts.
- Add a panel for recent events.
- Modify existing dashboard to include a section for inactive cities.

This commit introduces a comprehensive dashboard that helps
admin users monitor the traffic and engagement statistics of
various cities. The changes include functionality to show
active and inactive cities based on their popularity,
allowing for better insights into user engagement across
the application.
2025-01-28 01:43:59 +08:00
2a0226eb68 feat: update sidekiq tasks manager for clarity
- Rename task label from 'Batch Generate Weather Arts' to 'Generate Weather Arts' for better understanding.
- Add a new button for manual task execution of 'BatchGenerateWeatherArts'.
- Update task value in form submissions to be more descriptive, enhancing maintainability.

These changes improve the usability of the Sidekiq tasks management interface, making it more intuitive for users to identify and execute tasks. The renamed button and the clear distinction between tasks aim to reduce confusion and assist in better workflow management.
2025-01-28 01:32:56 +08:00
8cd4c50024 fix: update log level for user agent logging
- Change logging to use Rails.logger.debug instead of
  Rails.logger.debugger for better compatibility.
- Remove unnecessary extra lines in the Sidekiq jobs file.

This commit ensures that log messages are recorded efficiently and
with the correct log level, improving logging practices in the
application.
2025-01-28 01:28:07 +08:00
4020f89271 style: change logging level for user agent
- Replace logger.info with logger.debugger for user agent logging.
- Commented out redundant info logging for blocked browsers.

This change improves the logging detail level for the user agent by
utilizing the debugger log method instead of info, which provides more
context during debugging sessions.
2025-01-28 01:26:31 +08:00
29de36f5fb chore: comment out deprecated allow_browser code
- Commented out the `allow_browser` lines to prevent
  disabling access for unsupported browsers.
- This change maintains previous behavior without removing
  the code permanently, allowing for future reference.
- The previous implementation was causing issues with
  newer browser versions, prompting the need for a review
  of browser support policies.
2025-01-28 01:25:40 +08:00
2e438166ee feat: implement sidekiq task management
- Add manual task execution buttons for BatchGenerateWeatherArtsWorker, RefreshSitemapWorker, and CleanAhoyDataWorker
- Improve browser blocking functionality in ApplicationController
- Refactor Sidekiq jobs management to include statistics and task execution
- Update various jobs to conform to new standards

This feature allows for more fine-grained control over Sidekiq tasks and improves the overall user experience.
2025-01-28 01:24:49 +08:00
bf2ff282bb refactor: rename workers to jobs
- Change class names from Worker to Job for better alignment
  with Rails convention.
- Includes changes in BatchGenerateWeatherArtsJob,
  CleanAhoyDataJob, GenerateWeatherArtJob, and
  RefreshSitemapJob classes.

This refactoring improves the clarity and consistency of the
codebase by adhering to established naming conventions,
making it easier for new developers to understand the
role of these classes within the application.
2025-01-28 01:16:17 +08:00
ce5d09b621 feat: add admin management for various entities
- Add menu labels and parents for AdminUser, City, Country, Region, WeatherArt, Ahoy::Event, and Ahoy::Visit.
- Introduce a new page for managing Sidekiq jobs, providing functionality to execute or delete scheduled jobs.
- Adjust batch job for generating weather art by using Sidekiq for improved performance.
- Implement clean-up worker for old Ahoy data and functionalities for refreshing the sitemap.

These changes enhance the administration interface by providing better organization and management tools for backend entities. The addition of Sidekiq jobs management further improves system maintenance capabilities.
2025-01-28 01:15:29 +08:00
c68fecf3fa
Update application_controller.rb 2025-01-27 09:50:39 +08:00
16ee512b0c
Update application_controller.rb 2025-01-27 09:42:08 +08:00
111fd85ebb
Update application_controller.rb 2025-01-27 09:30:01 +08:00
59a3f792c6
Update application_controller.rb 2025-01-27 09:20:14 +08:00
9e666310cf
Update application_controller.rb 2025-01-27 09:14:19 +08:00
cc74145033
Update application_controller.rb 2025-01-27 09:00:54 +08:00
3e713a9b26
Update application_controller.rb 2025-01-27 08:43:50 +08:00
263c85486c
Update application_controller.rb 2025-01-27 08:23:44 +08:00
a895216bda
Update application_controller.rb
Some checks are pending
Docker / docker (push) Waiting to run
2025-01-27 07:49:08 +08:00
75cdd69b9b
Update application_controller.rb 2025-01-27 07:40:13 +08:00
70f977cae1 更新 application.html.erb 2025-01-27 07:01:20 +08:00
444c3e67bc 更新 application.html.erb 2025-01-27 07:01:20 +08:00
ffbd201d62 更新 application_controller.rb 2025-01-27 07:01:20 +08:00
5bfa94bc82
更新 application.html.erb 2025-01-27 06:54:24 +08:00
f59955ca6e
更新 application.html.erb 2025-01-27 01:38:21 +08:00
978cec359e feat: add docker CI workflow for development
- Create new workflow for building and pushing Docker
  images on push to 'dev' branch.
- Rename existing docker.yml to docker-main.yml and
  update image tag from 'latest' to 'main'.

This commit enhances the CI process by integrating Docker builds for
continuous delivery on the development branch, ensuring a clear
versioning strategy with updated tagging for production readiness.
2025-01-27 01:07:10 +08:00
6eca78da8d fix: update JSONB handling for ahoy events
- Change query conditions in City model to use the
  `properties::jsonb` syntax for compatibility.
- Update WeatherArt model's event counting to reflect
  the same JSONB handling for consistency across models.

These changes ensure that the queries correctly access the
JSONB fields in the database, which enhances robustness
when handling different database adapters like Postgres
or SQLite. This fixes potential issues with ahoy events
not being counted accurately due to incorrect property access.
2025-01-27 01:05:16 +08:00
f918a42619 fix: correct string quotation in city scope
- Change single quotes to double quotes for adapter name check

This change ensures consistent usage of double quotes in the
conditional check for the SQLite adapter. It does not affect
any functionality but improves code readability.
2025-01-27 00:50:35 +08:00
adb671e668 feat: add least popular active cities panel
- Introduce new panel in the admin dashboard for displaying
  the least popular active cities.
- Implement a database scope `least_popular_active` to
  retrieve cities based on their view counts.
- Ensure compatibility with both SQLite and PostgreSQL
  for fetching city view data.

This addition enhances the admin dashboard by allowing
administrators to easily identify and manage cities that
are receiving less user interaction, thus aiding in strategic
planning for engagement and promotion.
2025-01-27 00:48:07 +08:00
50321533f7 chore: clean up trailing whitespace and formatting
- Removed unnecessary leading and trailing blank lines in several
  ActiveAdmin register files.
- Reformatted string delimiters for consistency, changing single quotes
to double quotes in tracking events in the Cities and WeatherArts
controllers.
- Ensured proper spacing in array definitions across several
  models, including Ahoy::Event and Ahoy::Visit.

These changes improve code readability and maintain consistency
throughout the codebase by ensuring uniform use of quotes and
removing excess whitespace.
2025-01-27 00:43:36 +08:00
dd6cd0451d feat: add ahoy analytics for event tracking
- Integrate Ahoy gem for tracking user events and visits
- Create models for Ahoy events and visits
- Implement admin interfaces for managing events and visits
- Add background job for cleaning up old analytics data
- Update application controller and other relevant controllers to track specific actions

This commit implements a comprehensive event tracking system that logs user interactions
within the application. Additionally, it includes mechanisms for managing and
cleaning historical visit and event data, ensuring efficient data handling.
2025-01-27 00:43:18 +08:00
5f30e08a6e refactor: update city ordering
Order cities by name instead of filtering active cities. This change simplifies the CitiesController and improves code readability.

- Update City.includes method in CitiesController
- Remove active filter in City.includes method
2025-01-26 23:49:35 +08:00
bf10e41c1e fix: update view variable names for clarity
- Rename page view variables for consistency:
  - `busuanzi_value_page_pv` to `busuanzi_page_pv`
  - `busuanzi_value_page_uv` to `busuanzi_page_uv`
  - `busuanzi_value_site_pv` to `busuanzi_site_pv`
  - `busuanzi_value_site_uv` to `busuanzi_site_uv`

These changes improve the readability of the code by removing redundant parts of the variable names. This ensures that variables accurately reflect their purpose without unnecessary prefixes. The functionality remains unchanged.
2025-01-26 12:35:55 +08:00
9d1ff31c53 style: make busuanzi_container visible
- Change visibility of busuanzi_container from hidden to default

This change allows page view counts to be visible to users, improving
transparency regarding page engagement metrics.
2025-01-26 02:36:26 +08:00
155669866a style: adjust font size in footer container
Some checks failed
CI / scan_ruby (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
Docker / docker (push) Has been cancelled
- Change font size from 'text-sm' to 'text-xs' for better visibility

This adjustment improves the aesthetics of the footer by ensuring that the
text is appropriately sized and matches the overall design of the page.
2025-01-26 02:29:43 +08:00
8cacf2a9ff style: update footer layout and visibility
- Adjust footer padding for improved spacing
- Change visitor and view statistics display to a more concise
  format
- Maintain consistent font sizes for better readability

These changes enhance the visual presentation of the footer
while maintaining the functionality of hidden visitor statistics.
2025-01-26 02:27:19 +08:00
b0bdb72f8e feat: enhance site statistics display
- Update footer padding for better spacing
- Add hidden container for site statistics
- Modify display of page and total site statistics

These changes improve the presentation and organization of site statistics, making it easier for users to understand site traffic and engagement.
2025-01-26 02:19:56 +08:00
cea07ccfea chore: remove active_admin.js and add analytics scripts
- Removed the active_admin.js file from the project as it is no longer needed.
- Added the Busuanzi site statistics script to the application layout for
  tracking page views and visitors.
- Updated the footer layout to include site statistics, providing users
  with real-time view and visitor counts.

These changes streamline the asset management by removing unused files and
integrate site analytics directly into the footer for better visibility.
2025-01-26 02:08:48 +08:00
5c8308a991 feat: enhance city weather art view
- Update layout with improved styles and spacing
- Modify sections for better visual hierarchy
- Add gradient effects and responsive design adjustments

These changes enhance the overall user experience by providing a
more visually appealing and organized layout for the city
weather art view. Adjustments include background effects,
updated navigation, and improved display of weather statistics
and history records.
2025-01-26 00:35:08 +08:00
5feaee4922 feat: add sitemap functionality
- Create SitemapsController to serve sitemaps
- Configure AWS S3 storage for sitemaps
- Update routes to include sitemap paths
- Add SitemapsHelper module
- Configure SitemapGenerator with AWS adapter
- Update storage configurations for AWS

This feature adds sitemap functionality to the application, enabling search engines to discover and index its content more efficiently. It includes configuration for AWS S3 storage to host the sitemaps and updates the application's routes to serve them.
2025-01-26 00:07:44 +08:00
ead795266e refactor: simplify sitemap scheduling process
- Removed conditional check for production environment in
  the initializer to ensure the sitemap refresh worker
  always runs at startup.
- Renamed Sidekiq configuration file from sidekiq.yml to
  sidekiq_scheduler.yml to better reflect its purpose.

These changes streamline the initialization process
for scheduled tasks and enhance the clarity of the
configuration files used in the project.
2025-01-25 11:24:44 +08:00
1ca468f9af fix: improve error handling for sitemap task
- Add error handling when scheduling the RefreshSitemapWorker in
  production.
- Log successful scheduling and errors for improved diagnostics.

This change ensures that any issues with scheduling the worker are
logged and can be addressed promptly, enhancing the reliability of
the application in production.
2025-01-25 11:05:53 +08:00
1f35664590 fix: correct conditional for sitemap refresh
- Update the condition to check for 'RAILS_BUILD' environment variable
- Allow RefreshSitemapWorker to run in development/test environments

This change clarifies the logic for executing the sitemap refresh worker by
inverting the condition to allow it to run when 'RAILS_BUILD' is not set,
ensuring proper functionality during development and testing phases.
2025-01-25 11:01:29 +08:00
40631fe95b fix: alter sitemap refresh condition
- Change the condition to prevent sitemap refresh in production when
  `RAILS_BUILD` is set.
- Ensures that the task only runs in development or non-production
  environments, avoiding potential conflicts or wasted resources.

This change helps to streamline the initialization process and enhances
performance by not triggering unnecessary background tasks.
2025-01-25 10:56:13 +08:00
f7c5ae4ee7 chore: conditionally refresh sitemap
- Modified the schedule_tasks.rb initializer to only run RefreshSitemapWorker.perform_async unless RAILS_BUILD environment variable is set
This change optimizes the build process by preventing unnecessary sitemap refreshes during build time, thus improving overall project performance.
2025-01-25 10:54:19 +08:00
742c94ced1 style: update layout of city show view
- Change stats div to be responsive
- Adjust coordinates display format for better readability

This update enhances the layout of the city show view by making
it more responsive and improving the display of weather and
geographical data. Additionally, the startup task for
refreshing the sitemap is now consistently executed,
removing unnecessary complexity.
2025-01-25 10:51:14 +08:00
c37a93bcdf feat: remove trailing newline at end of file
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
Docker / docker (push) Waiting to run
Remove trailing newline at end of file in `schedule_tasks.rb`.

- Modify file to remove unnecessary newline at end of file.
2025-01-25 01:55:00 +08:00
7ebf9cefae feat: switch startup task to Sidekiq with Redis cache
- Update schedule tasks to use Sidekiq and Redis
- Improve task scheduling with caching
- Remove unnecessary code and error handling

This change enhances the reliability and performance of the startup task, leveraging the power of Sidekiq and Redis for background job processing and caching. The improvements ensure a smoother and more efficient application startup experience.
2025-01-25 01:49:28 +08:00
dd37e2835b style: add newline at end of schedule_tasks.rb
This commit adds a newline at the end of the 'schedule_tasks.rb' file to comply with the standard coding practices. Proper file formatting helps in maintaining code consistency across the project.
2025-01-25 01:38:35 +08:00