refactor: Remove unnecessary debug print statements

- Removed several `println!` statements from the `governance`
  controller and `proposals` database module to improve code
  cleanliness and reduce unnecessary console output.
- Updated the `all_activities.html` template to use the
  `created_at` field instead of `timestamp` for activity dates.
- Updated the `index.html` template to use the `created_at`
  field instead of `timestamp` for activity timestamps.
- Added `#[allow(unused_assignments)]` attribute to the
  `create_activity` function in `proposals.rs` to suppress a
  potentially unnecessary warning.
This commit is contained in:
Mahmoud-Emad 2025-05-28 09:24:56 +03:00
parent 11d7ae37b6
commit 7b15606da5
4 changed files with 7 additions and 12 deletions

View File

@ -83,7 +83,6 @@ impl GovernanceController {
/// Handles the governance dashboard page route
pub async fn index(tmpl: web::Data<Tera>, session: Session) -> Result<impl Responder> {
println!("==============================================");
let mut ctx = tera::Context::new();
ctx.insert("active_page", "governance");
ctx.insert("active_tab", "dashboard");
@ -100,14 +99,13 @@ impl GovernanceController {
let user = Self::get_user_from_session(&session).unwrap();
ctx.insert("user", &user);
println!("==============================================");
// Get proposals from the database
let proposals = match crate::db::proposals::get_proposals() {
Ok(props) => {
println!(
"📋 Proposals list page: Successfully loaded {} proposals from database",
props.len()
);
// println!(
// "📋 Proposals list page: Successfully loaded {} proposals from database",
// props.len()
// );
for (i, proposal) in props.iter().enumerate() {
println!(
" Proposal {}: ID={}, title={:?}, status={:?}",
@ -125,7 +123,6 @@ impl GovernanceController {
vec![]
}
};
println!("==============================================");
// Make a copy of proposals for statistics
let proposals_for_stats = proposals.clone();
@ -192,7 +189,6 @@ impl GovernanceController {
ctx.insert("user", &user);
}
println!("============== Loading proposals =================");
// Get proposals from the database
let mut proposals = match get_proposals() {
Ok(props) => props,
@ -202,8 +198,6 @@ impl GovernanceController {
}
};
println!("proposals: {:?}", proposals);
// Filter proposals by status if provided
if let Some(status_filter) = &query.status {
if !status_filter.is_empty() {

View File

@ -189,6 +189,7 @@ pub fn submit_vote_on_proposal(
Ok(updated_proposal)
}
#[allow(unused_assignments)]
/// Creates a new governance activity and saves it to the database using OurDB
pub fn create_activity(
proposal_id: u32,

View File

@ -54,7 +54,7 @@
</td>
<td>
<small class="text-muted">
{{ activity.timestamp | date(format="%Y-%m-%d %H:%M") }}
{{ activity.created_at | date(format="%Y-%m-%d %H:%M") }}
</small>
</td>
</tr>

View File

@ -130,7 +130,7 @@
<div>
<div class="d-flex justify-content-between align-items-center">
<strong>{{ activity.user }}</strong>
<small class="text-muted">{{ activity.timestamp | date(format="%H:%M") }}</small>
<small class="text-muted">{{ activity.created_at | date(format="%H:%M") }}</small>
</div>
<p class="mb-1">{{ activity.action }} on <a
href="/governance/proposals/{{ activity.proposal_id }}">{{