WIP: development_backend #4
@@ -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() {
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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 }}">{{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user